Check the negative return value after an open syscall
authorLaszlo Papp <ext-laszlo.papp@nokia.com>
Wed, 9 Mar 2011 15:22:07 +0000 (17:22 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Wed, 30 Mar 2011 17:34:58 +0000 (19:34 +0200)
lib/mount.c

index 224ae9d5f299e3e497475d24400587f031e41d78..8065087d4a1deeffe06ae1dae4c5114b944785ad 100644 (file)
@@ -366,8 +366,10 @@ static int fuse_mount_fusermount(const char *mountpoint, const char *opts,
 
                if (quiet) {
                        int fd = open("/dev/null", O_RDONLY);
-                       dup2(fd, 1);
-                       dup2(fd, 2);
+                       if (fd != -1) {
+                               dup2(fd, 1);
+                               dup2(fd, 2);
+                       }
                }
 
                argv[a++] = FUSERMOUNT_PROG;