From ba7a056d586f78954ac874a3bebc6325f7e6eeb1 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 27 Oct 2011 15:47:18 -0500 Subject: 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 --- src/pacman/conf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/pacman') 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) { -- cgit v1.2.3-70-g09d2