From d34701d49cf5b30f5b9963dab5643b4b62704413 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 23 Feb 2008 10:47:18 +0100 Subject: [PATCH] Check return value of dup(2) --- source/lib/sock_exec.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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]); -- 2.47.3