From b50873653627be1bd12ae070667cb919d667a39a Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 10 Dec 2014 09:12:56 +0000 Subject: Fix child_spawn fd closing when n=1 --- src/libstddjb/child_spawn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstddjb/child_spawn.c b/src/libstddjb/child_spawn.c index 867f800..5d696e4 100644 --- a/src/libstddjb/child_spawn.c +++ b/src/libstddjb/child_spawn.c @@ -192,7 +192,7 @@ pid_t child_spawn (char const *prog, char const *const *argv, char const *const fd_close(syncpipe[0]) ; #endif - for (; i ; i--) + for (i = n ; i ; i--) { fd_close(p[i-1][i & 1]) ; fds[i-1] = p[i-1][!(i & 1)] ; -- cgit v1.2.3