diff options
author | Laszlo Papp <ext-laszlo.papp@nokia.com> | 2011-03-09 18:01:30 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2011-03-30 19:34:58 +0200 |
commit | b812c4c40627809d92d7cb4b3de1059066399380 (patch) | |
tree | 74ff5b5ad3c51c0c7d78a9ad66e525f77d56f64f /lib/mount_util.c | |
parent | b0ceaa067057cf91caa180636d2e4c3dc786a98f (diff) |
Check the return value after an open syscall
Diffstat (limited to 'lib/mount_util.c')
-rw-r--r-- | lib/mount_util.c | 6 |
1 files changed, 4 insertions, 2 deletions
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()); |