summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-02-23 10:47:18 +0100
committerVolker Lendecke <vl@samba.org>2008-02-23 11:04:13 +0100
commit333c0aabc99df4ad6fed1d79d0fe66015b5d2ef6 (patch)
treef5f131e6790c05a69f83d7db249f2562e62c2ff3
parent6dfb2614d81e2381c2fc5d9b4d4f152a56bfce5d (diff)
downloadsamba-333c0aabc99df4ad6fed1d79d0fe66015b5d2ef6.tar.gz
samba-333c0aabc99df4ad6fed1d79d0fe66015b5d2ef6.tar.bz2
samba-333c0aabc99df4ad6fed1d79d0fe66015b5d2ef6.zip
Check return value of dup(2)
(This used to be commit d34701d49cf5b30f5b9963dab5643b4b62704413)
-rw-r--r--source3/lib/sock_exec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source3/lib/sock_exec.c b/source3/lib/sock_exec.c
index 203d7e93b3..278a174663 100644
--- a/source3/lib/sock_exec.c
+++ b/source3/lib/sock_exec.c
@@ -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]);