[pacman-dev] [PATCH] _alpm_run_chroot: only close working directory if it was opened
23 Dec
2014
23 Dec
'14
9:58 p.m.
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 43d0d7b..22408d7 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -542,7 +542,9 @@ int _alpm_run_chroot(alpm_handle_t *handle, const char *cmd, char *const argv[]) while(dup2(pipefd[1], 2) == -1 && errno == EINTR); close(pipefd[0]); close(pipefd[1]); - close(cwdfd); + if(cwdfd >= 0) { + close(cwdfd); + } /* use fprintf instead of _alpm_log to send output through the parent */ if(chroot(handle->root) != 0) { -- 2.2.1
3662
Age (days ago)
3662
Last active (days ago)
0 comments
1 participants
participants (1)
-
Allan McRae