summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/util.h
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-07-04 02:33:19 +0200
committerAllan McRae <allan@archlinux.org>2013-07-05 06:32:23 +0200
commiteb19d41d5f85f169cee7570f783821cb705ad37a (patch)
tree245a12aa27e01a6f8ee74f5c1624d4e341551b81 /lib/libalpm/util.h
parent7b8f8753b15037bf4a88126ffde8195416432c72 (diff)
downloadpacman-eb19d41d5f85f169cee7570f783821cb705ad37a.tar.gz
pacman-eb19d41d5f85f169cee7570f783821cb705ad37a.tar.xz
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/util.h')
-rw-r--r--lib/libalpm/util.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index 24b7c229..c12b39b7 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -88,7 +88,6 @@ void _alpm_alloc_fail(size_t size);
#endif
#define OPEN(fd, path, flags) do { fd = open(path, flags | O_BINARY); } while(fd == -1 && errno == EINTR)
-#define CLOSE(fd) do { int _ret; do { _ret = close(fd); } while(_ret == -1 && errno == EINTR); } while(0)
/**
* Used as a buffer/state holder for _alpm_archive_fgets().