Blame SOURCES/kvm-pr-helper-fix-socket-path-default-in-help.patch

357786
From ba4e622bc5d07daba8a63589124c944d6105e054 Mon Sep 17 00:00:00 2001
357786
From: Paolo Bonzini <pbonzini@redhat.com>
357786
Date: Fri, 6 Jul 2018 17:56:51 +0200
357786
Subject: [PATCH 17/89] pr-helper: fix --socket-path default in help
357786
MIME-Version: 1.0
357786
Content-Type: text/plain; charset=UTF-8
357786
Content-Transfer-Encoding: 8bit
357786
357786
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
357786
Message-id: <20180706175659.30615-2-pbonzini@redhat.com>
357786
Patchwork-id: 81244
357786
O-Subject: [RHEL7.6 qemu-kvm-rhev PATCH 1/9] pr-helper: fix --socket-path default in help
357786
Bugzilla: 1533158
357786
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
357786
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
357786
RH-Acked-by: Michal Privoznik <mprivozn@redhat.com>
357786
357786
Currently --help shows "(default '(null)')" for the -k/--socket-path
357786
option.  Fix it by getting the default path in /var/run.
357786
357786
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
357786
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
357786
(cherry picked from commit 50fa332516d5e42695811f43396b749185e21b9c)
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 scsi/qemu-pr-helper.c | 15 ++++++++-------
357786
 1 file changed, 8 insertions(+), 7 deletions(-)
357786
357786
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
357786
index 7a29e64..19887f5 100644
357786
--- a/scsi/qemu-pr-helper.c
357786
+++ b/scsi/qemu-pr-helper.c
357786
@@ -74,8 +74,16 @@ static int uid = -1;
357786
 static int gid = -1;
357786
 #endif
357786
 
357786
+static void compute_default_paths(void)
357786
+{
357786
+    if (!socket_path) {
357786
+        socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
357786
+    }
357786
+}
357786
+
357786
 static void usage(const char *name)
357786
 {
357786
+    compute_default_paths();
357786
     (printf) (
357786
 "Usage: %s [OPTIONS] FILE\n"
357786
 "Persistent Reservation helper program for QEMU\n"
357786
@@ -834,13 +842,6 @@ static const char *socket_activation_validate_opts(void)
357786
     return NULL;
357786
 }
357786
 
357786
-static void compute_default_paths(void)
357786
-{
357786
-    if (!socket_path) {
357786
-        socket_path = qemu_get_local_state_pathname("run/qemu-pr-helper.sock");
357786
-    }
357786
-}
357786
-
357786
 static void termsig_handler(int signum)
357786
 {
357786
     atomic_cmpxchg(&state, RUNNING, TERMINATE);
357786
-- 
357786
1.8.3.1
357786