summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-18 20:02:40 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-18 20:02:40 +0000
commiteabd95d0385c9600ed5b75d37398498c19f64d9d (patch)
tree4860eab0a3216f76ff88931febda9b78969ee817 /src
parent5f76ed9108c5c48850cf339096527c4d53f0bc12 (diff)
downloadskalibs-eabd95d0385c9600ed5b75d37398498c19f64d9d.tar.xz
fd leak fix in child_spawn1_internal
Diffstat (limited to 'src')
-rw-r--r--src/libstddjb/child_spawn1_internal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstddjb/child_spawn1_internal.c b/src/libstddjb/child_spawn1_internal.c
index 68b0242..6706b80 100644
--- 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") ;