From: Laszlo Papp Date: Wed, 9 Mar 2011 16:01:30 +0000 (+0200) Subject: Check the return value after an open syscall X-Git-Tag: fuse_2_9_0~67 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b812c4c40627809d92d7cb4b3de1059066399380;p=qemu-gpiodev%2Flibfuse.git Check the return value after an open syscall --- diff --git a/lib/mount_util.c b/lib/mount_util.c index 5b660d6..aafddfb 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -100,8 +100,10 @@ static int add_mount(const char *progname, const char *fsname, * --no-canonicalize */ int fd = open("/dev/null", O_WRONLY); - dup2(fd, 1); - dup2(fd, 2); + if (fd >= 0) { + dup2(fd, 1); + dup2(fd, 2); + } sigprocmask(SIG_SETMASK, &oldmask, NULL); setuid(geteuid());