Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/add.c
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-07-03 20:33:19 -0400
committerAllan McRae <allan@archlinux.org>2013-07-05 14:32:23 +1000
commiteb19d41d5f85f169cee7570f783821cb705ad37a (patch)
tree245a12aa27e01a6f8ee74f5c1624d4e341551b81 /lib/libalpm/add.c
parent7b8f8753b15037bf4a88126ffde8195416432c72 (diff)
do not check error from close(2)
On operating systems we support, the behavior is always such that the kernel will do the right thing as far as invalidating the file descriptor, regardless of the eventual return value. Therefore, potentially looping and calling close multiple times is wrong. At best, we call close again on an invalid FD and throw a spurious EBADF error. At worst, we might close an FD which doesn't belong to us when a multi-threaded application opens its own file descriptor between iterations of the loop. Signed-off-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r--lib/libalpm/add.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 3d0cf55a..8ef9ef0e 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -552,7 +552,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
handle->root, strerror(errno));
_alpm_archive_read_free(archive);
- CLOSE(fd);
+ close(fd);
ret = -1;
goto cleanup;
}
@@ -582,7 +582,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
}
_alpm_archive_read_free(archive);
- CLOSE(fd);
+ close(fd);
/* restore the old cwd if we have it */
if(cwdfd >= 0) {
@@ -590,7 +590,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
_alpm_log(handle, ALPM_LOG_ERROR,
_("could not restore working directory (%s)\n"), strerror(errno));
}
- CLOSE(cwdfd);
+ close(cwdfd);
}
if(errors) {