Check return value of dup(2)
authorVolker Lendecke <vl@samba.org>
Sat, 23 Feb 2008 09:47:18 +0000 (10:47 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 23 Feb 2008 10:04:13 +0000 (11:04 +0100)
source/lib/sock_exec.c

index 203d7e93b3fd581cc3f9b67f930d9d6a80902151..278a174663aedc63b3607e7131f30956cd01099b 100644 (file)
@@ -105,8 +105,12 @@ int sock_exec(const char *prog)
                close(fd[0]);
                close(0);
                close(1);
-               dup(fd[1]);
-               dup(fd[1]);
+               if (dup(fd[1]) == -1) {
+                       exit(1);
+               }
+               if (dup(fd[1]) == -1) {
+                       exit(1);
+               }
                exit(system(prog));
        }
        close(fd[1]);