From b0ceaa067057cf91caa180636d2e4c3dc786a98f Mon Sep 17 00:00:00 2001 From: Laszlo Papp Date: Wed, 9 Mar 2011 17:22:07 +0200 Subject: Check the negative return value after an open syscall --- lib/mount.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/mount.c') diff --git a/lib/mount.c b/lib/mount.c index 224ae9d..8065087 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -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; -- cgit v1.2.3