yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

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

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