From: Volker Lendecke Date: Sat, 23 Feb 2008 09:47:18 +0000 (+0100) Subject: Check return value of dup(2) X-Git-Tag: samba-3.2.0pre2~37^2~152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d34701d49cf5b30f5b9963dab5643b4b62704413;p=thirdparty%2Fsamba.git Check return value of dup(2) --- diff --git a/source/lib/sock_exec.c b/source/lib/sock_exec.c index 203d7e93b3f..278a174663a 100644 --- a/source/lib/sock_exec.c +++ b/source/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]);