diff options
author | Dan McGee <dan@archlinux.org> | 2011-10-27 22:47:18 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-11-01 16:27:31 +0100 |
commit | ba7a056d586f78954ac874a3bebc6325f7e6eeb1 (patch) | |
tree | 03172fa34a61ab78d24c0b46747aaff9ca4c4875 /src | |
parent | a4ce3edf95f148bc6eac16b6edd9bc281c7745af (diff) | |
download | pacman-ba7a056d586f78954ac874a3bebc6325f7e6eeb1.tar.gz pacman-ba7a056d586f78954ac874a3bebc6325f7e6eeb1.tar.xz |
Add OPEN() and CLOSE() util macros
These wrap the normal open() and close() low-level I/O calls and ensure
EINTR is handled correctly.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/conf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 2d3009ec..69562067 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -203,11 +203,14 @@ static int download_with_xfercommand(const char *url, const char *localpath, cleanup: /* restore the old cwd if we have it */ if(cwdfd >= 0) { + int ret; if(fchdir(cwdfd) != 0) { pm_printf(ALPM_LOG_ERROR, _("could not restore working directory (%s)\n"), strerror(errno)); } - close(cwdfd); + do { + ret = close(cwdfd); + } while(ret == -1 && errno == EINTR); } if(ret == -1) { |