Check the return value properly before passing it to any function
authorLaszlo Papp <ext-laszlo.papp@nokia.com>
Tue, 15 Mar 2011 08:33:08 +0000 (10:33 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Wed, 30 Mar 2011 17:34:58 +0000 (19:34 +0200)
util/ulockmgr_server.c

index 8ffdfef92b6a878cde5f7e38639d463f12e3d8f3..583fcf9f9ec54b6ad5cc540b1365b7042bc1d7f2 100644 (file)
@@ -366,8 +366,10 @@ int main(int argc, char *argv[])
        }
        cfd = 4;
        nullfd = open("/dev/null", O_RDWR);
-       dup2(nullfd, 0);
-       dup2(nullfd, 1);
+       if (nullfd >= 0) {
+               dup2(nullfd, 0);
+               dup2(nullfd, 1);
+       }
        close(3);
        closefrom(5);
        while (1) {