From 333c0aabc99df4ad6fed1d79d0fe66015b5d2ef6 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 23 Feb 2008 10:47:18 +0100 Subject: Check return value of dup(2) (This used to be commit d34701d49cf5b30f5b9963dab5643b4b62704413) --- source3/lib/sock_exec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/lib') 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]); -- cgit