Blame SOURCES/kvm-virtiofsd-convert-more-fprintf-and-perror-to-use-fus.patch

22c213
From e00543b0384fba61a9c7274c73e11a25e7ab2946 Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:02:13 +0100
22c213
Subject: [PATCH 102/116] virtiofsd: convert more fprintf and perror to use
22c213
 fuse log infra
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Message-id: <20200127190227.40942-99-dgilbert@redhat.com>
22c213
Patchwork-id: 93552
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 098/112] virtiofsd: convert more fprintf and perror to use fuse log infra
22c213
Bugzilla: 1694164
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
22c213
22c213
From: Eryu Guan <eguan@linux.alibaba.com>
22c213
22c213
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
22c213
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
22c213
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
22c213
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit fc1aed0bf96259d0b46b1cfea7497b7762c4ee3d)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/fuse_signals.c | 7 +++++--
22c213
 tools/virtiofsd/helper.c       | 9 ++++++---
22c213
 2 files changed, 11 insertions(+), 5 deletions(-)
22c213
22c213
diff --git a/tools/virtiofsd/fuse_signals.c b/tools/virtiofsd/fuse_signals.c
22c213
index dc7c8ac..f18625b 100644
22c213
--- a/tools/virtiofsd/fuse_signals.c
22c213
+++ b/tools/virtiofsd/fuse_signals.c
22c213
@@ -12,6 +12,7 @@
22c213
 #include "fuse_i.h"
22c213
 #include "fuse_lowlevel.h"
22c213
 
22c213
+#include <errno.h>
22c213
 #include <signal.h>
22c213
 #include <stdio.h>
22c213
 #include <stdlib.h>
22c213
@@ -47,13 +48,15 @@ static int set_one_signal_handler(int sig, void (*handler)(int), int remove)
22c213
     sa.sa_flags = 0;
22c213
 
22c213
     if (sigaction(sig, NULL, &old_sa) == -1) {
22c213
-        perror("fuse: cannot get old signal handler");
22c213
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot get old signal handler: %s\n",
22c213
+                 strerror(errno));
22c213
         return -1;
22c213
     }
22c213
 
22c213
     if (old_sa.sa_handler == (remove ? handler : SIG_DFL) &&
22c213
         sigaction(sig, &sa, NULL) == -1) {
22c213
-        perror("fuse: cannot set signal handler");
22c213
+        fuse_log(FUSE_LOG_ERR, "fuse: cannot set signal handler: %s\n",
22c213
+                 strerror(errno));
22c213
         return -1;
22c213
     }
22c213
     return 0;
22c213
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
22c213
index 33749bf..f98d8f2 100644
22c213
--- a/tools/virtiofsd/helper.c
22c213
+++ b/tools/virtiofsd/helper.c
22c213
@@ -208,7 +208,8 @@ int fuse_daemonize(int foreground)
22c213
         char completed;
22c213
 
22c213
         if (pipe(waiter)) {
22c213
-            perror("fuse_daemonize: pipe");
22c213
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n",
22c213
+                     strerror(errno));
22c213
             return -1;
22c213
         }
22c213
 
22c213
@@ -218,7 +219,8 @@ int fuse_daemonize(int foreground)
22c213
          */
22c213
         switch (fork()) {
22c213
         case -1:
22c213
-            perror("fuse_daemonize: fork");
22c213
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: fork: %s\n",
22c213
+                     strerror(errno));
22c213
             return -1;
22c213
         case 0:
22c213
             break;
22c213
@@ -228,7 +230,8 @@ int fuse_daemonize(int foreground)
22c213
         }
22c213
 
22c213
         if (setsid() == -1) {
22c213
-            perror("fuse_daemonize: setsid");
22c213
+            fuse_log(FUSE_LOG_ERR, "fuse_daemonize: setsid: %s\n",
22c213
+                     strerror(errno));
22c213
             return -1;
22c213
         }
22c213
 
22c213
-- 
22c213
1.8.3.1
22c213