diff options
author | Allan McRae <allan@archlinux.org> | 2014-12-24 03:57:38 +0100 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-12-27 08:08:32 +0100 |
commit | 804688ab6a036a80e082354c497ddc2d21ac2979 (patch) | |
tree | 45ab269c37121d57bf1fa15dd7527f7f88566792 /lib | |
parent | 2f0ca00e5530d38e8ee2005f7d1129a92bf34231 (diff) | |
download | pacman-804688ab6a036a80e082354c497ddc2d21ac2979.tar.gz pacman-804688ab6a036a80e082354c497ddc2d21ac2979.tar.xz |
_alpm_run_chroot: only close working directory if it was opened
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/util.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 43d0d7be..22408d70 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) { |