commit eabd95d0385c9600ed5b75d37398498c19f64d9d
parent 5f76ed9108c5c48850cf339096527c4d53f0bc12
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date: Thu, 18 Dec 2014 20:02:40 +0000
fd leak fix in child_spawn1_internal
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c
@@ -33,10 +33,10 @@ pid_t child_spawn1_internal (char const *prog, char const *const *argv, char con
if (e) goto errattr ;
e = posix_spawn_file_actions_init(&actions) ;
if (e) goto errattr ;
- e = posix_spawn_file_actions_addclose(&actions, p[!to]) ;
- if (e) goto erractions ;
e = posix_spawn_file_actions_adddup2(&actions, p[to], to) ;
if (e) goto erractions ;
+ e = posix_spawn_file_actions_addclose(&actions, p[to]) ;
+ if (e) goto erractions ;
if (!haspath && (setenv("PATH", SKALIBS_DEFAULTPATH, 0) < 0)) { e = errno ; goto erractions ; }
e = posix_spawnp(&pid, prog, &actions, &attr, (char *const *)argv, (char *const *)envp) ;
if (!haspath) unsetenv("PATH") ;