pr-helper: fix --socket-path default in help

Currently --help shows "(default '(null)')" for the -k/--socket-path
option.  Fix it by getting the default path in /var/run.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
This commit is contained in:
Paolo Bonzini 2018-06-26 13:55:04 +02:00
parent c44df2ff9b
commit 50fa332516

View file

@ -74,8 +74,16 @@ static int uid = -1;
static int gid = -1;
#endif
static void compute_default_paths(void)
{
if (!socket_path) {
socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
}
}
static void usage(const char *name)
{
compute_default_paths();
(printf) (
"Usage: %s [OPTIONS] FILE\n"
"Persistent Reservation helper program for QEMU\n"
@ -845,13 +853,6 @@ static const char *socket_activation_validate_opts(void)
return NULL;
}
static void compute_default_paths(void)
{
if (!socket_path) {
socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
}
}
static void termsig_handler(int signum)
{
atomic_cmpxchg(&state, RUNNING, TERMINATE);