[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/30] virtiofsd: Fix fuse_daemonize ignored return values
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PATCH 09/30] virtiofsd: Fix fuse_daemonize ignored return values |
Date: |
Mon, 21 Oct 2019 11:58:11 +0100 |
From: "Dr. David Alan Gilbert" <address@hidden>
QEMU's compiler enables warnings/errors for ignored values
and the (void) trick used in the fuse code isn't enough.
Turn all the return values into a return value on the function.
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
contrib/virtiofsd/helper.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/contrib/virtiofsd/helper.c b/contrib/virtiofsd/helper.c
index f7b00db258..958a42b6f4 100644
--- a/contrib/virtiofsd/helper.c
+++ b/contrib/virtiofsd/helper.c
@@ -10,12 +10,10 @@
See the file COPYING.LIB.
*/
-#include "config.h"
#include "fuse_i.h"
#include "fuse_misc.h"
#include "fuse_opt.h"
#include "fuse_lowlevel.h"
-#include "mount_util.h"
#include <stdio.h>
#include <stdlib.h>
@@ -173,6 +171,7 @@ int fuse_parse_cmdline(struct fuse_args *args,
int fuse_daemonize(int foreground)
{
+ int ret = 0, rett;
if (!foreground) {
int nullfd;
int waiter[2];
@@ -194,8 +193,8 @@ int fuse_daemonize(int foreground)
case 0:
break;
default:
- (void) read(waiter[0], &completed, sizeof(completed));
- _exit(0);
+ _exit( read(waiter[0], &completed, sizeof(completed) !=
+ sizeof(completed)));
}
if (setsid() == -1) {
@@ -203,26 +202,30 @@ int fuse_daemonize(int foreground)
return -1;
}
- (void) chdir("/");
+ ret = chdir("/");
nullfd = open("/dev/null", O_RDWR, 0);
if (nullfd != -1) {
- (void) dup2(nullfd, 0);
- (void) dup2(nullfd, 1);
- (void) dup2(nullfd, 2);
+ rett = dup2(nullfd, 0);
+ if (!ret) ret = rett;
+ rett = dup2(nullfd, 1);
+ if (!ret) ret = rett;
+ rett = dup2(nullfd, 2);
+ if (!ret) ret = rett;
if (nullfd > 2)
close(nullfd);
}
/* Propagate completion of daemon initialization */
completed = 1;
- (void) write(waiter[1], &completed, sizeof(completed));
+ rett = write(waiter[1], &completed, sizeof(completed));
+ if (!ret) ret = rett;
close(waiter[0]);
close(waiter[1]);
} else {
- (void) chdir("/");
+ ret = chdir("/");
}
- return 0;
+ return ret;
}
void fuse_apply_conn_info_opts(struct fuse_conn_info_opts *opts,
--
2.23.0
- [PATCH 00/30] virtiofs daemon (base), Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 02/30] virtiofsd: Pull in kernel's fuse.h, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 03/30] virtiofsd: Add auxiliary .c's, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 04/30] virtiofsd: Add fuse_lowlevel.c, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 01/30] virtiofsd: Pull in upstream headers, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 05/30] virtiofsd: Add passthrough_ll, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 07/30] virtiofsd: remove mountpoint dummy argument, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 06/30] virtiofsd: Trim down imported files, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 09/30] virtiofsd: Fix fuse_daemonize ignored return values,
Dr. David Alan Gilbert (git) <=
- [PATCH 08/30] virtiofsd: remove unused notify reply support, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 10/30] virtiofsd: Fix common header and define for QEMU builds, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 11/30] virtiofsd: fuse: Make iov_length usable outside fuse_lowlevel.c, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 12/30] virtiofsd: Make fsync work even if only inode is passed in, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 14/30] virtiofsd: add -o source=PATH to help output, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 13/30] virtiofsd: Add options for virtio, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 15/30] virtiofsd: Open vhost connection instead of mounting, Dr. David Alan Gilbert (git), 2019/10/21
- [PATCH 16/30] virtiofsd: Start wiring up vhost-user, Dr. David Alan Gilbert (git), 2019/10/21