thebeanogamer / rpms / qemu-kvm

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