virtiofsd: convert more fprintf and perror to use fuse log infra

Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Eryu Guan 2019-08-09 16:25:36 +08:00 committed by Dr. David Alan Gilbert
parent e468d4af5f
commit fc1aed0bf9
2 changed files with 11 additions and 5 deletions

View File

@ -12,6 +12,7 @@
#include "fuse_i.h" #include "fuse_i.h"
#include "fuse_lowlevel.h" #include "fuse_lowlevel.h"
#include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -47,13 +48,15 @@ static int set_one_signal_handler(int sig, void (*handler)(int), int remove)
sa.sa_flags = 0; sa.sa_flags = 0;
if (sigaction(sig, NULL, &old_sa) == -1) { if (sigaction(sig, NULL, &old_sa) == -1) {
perror("fuse: cannot get old signal handler"); fuse_log(FUSE_LOG_ERR, "fuse: cannot get old signal handler: %s\n",
strerror(errno));
return -1; return -1;
} }
if (old_sa.sa_handler == (remove ? handler : SIG_DFL) && if (old_sa.sa_handler == (remove ? handler : SIG_DFL) &&
sigaction(sig, &sa, NULL) == -1) { sigaction(sig, &sa, NULL) == -1) {
perror("fuse: cannot set signal handler"); fuse_log(FUSE_LOG_ERR, "fuse: cannot set signal handler: %s\n",
strerror(errno));
return -1; return -1;
} }
return 0; return 0;

View File

@ -208,7 +208,8 @@ int fuse_daemonize(int foreground)
char completed; char completed;
if (pipe(waiter)) { if (pipe(waiter)) {
perror("fuse_daemonize: pipe"); fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n",
strerror(errno));
return -1; return -1;
} }
@ -218,7 +219,8 @@ int fuse_daemonize(int foreground)
*/ */
switch (fork()) { switch (fork()) {
case -1: case -1:
perror("fuse_daemonize: fork"); fuse_log(FUSE_LOG_ERR, "fuse_daemonize: fork: %s\n",
strerror(errno));
return -1; return -1;
case 0: case 0:
break; break;
@ -228,7 +230,8 @@ int fuse_daemonize(int foreground)
} }
if (setsid() == -1) { if (setsid() == -1) {
perror("fuse_daemonize: setsid"); fuse_log(FUSE_LOG_ERR, "fuse_daemonize: setsid: %s\n",
strerror(errno));
return -1; return -1;
} }