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 --- lib/libalpm/add.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/libalpm/add.c') diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index c6830dce..d66ab934 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -547,9 +547,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, } /* save the cwd so we can restore it later */ - do { - cwdfd = open(".", O_RDONLY); - } while(cwdfd == -1 && errno == EINTR); + OPEN(cwdfd, ".", O_RDONLY); if(cwdfd < 0) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n")); } @@ -606,7 +604,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) { -- cgit v1.2.3-24-g4f1b