index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Allan McRae <allan@archlinux.org> | 2016-05-04 17:39:34 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2016-05-05 13:52:23 +1000 |
commit | 3729ef7a9acf75080fb6f60d13ea80cfd36d855d (patch) | |
tree | 4b2959aa37fde5700a8b5437ec9a3d8b4b917cae /lib | |
parent | b012da645e14e5f79968d6670dcc5e51232c4adb (diff) |
-rw-r--r-- | lib/libalpm/util.c | 14 |
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 4a4847de..1e554632 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -446,6 +446,16 @@ ssize_t _alpm_files_in_directory(alpm_handle_t *handle, const char *path, return files; } +static int should_retry(int errnum) +{ + return errnum == EAGAIN +/* EAGAIN may be the same value as EWOULDBLOCK (POSIX.1) - prevent GCC warning */ +#if EAGAIN != EWOULDBLOCK + || errnum == EWOULDBLOCK +#endif + || errnum == EINTR; +} + static int _alpm_chroot_write_to_child(alpm_handle_t *handle, int fd, char *buf, ssize_t *buf_size, ssize_t buf_limit, _alpm_cb_io out_cb, void *cb_ctx) @@ -476,7 +486,7 @@ static int _alpm_chroot_write_to_child(alpm_handle_t *handle, int fd, /* write was successful, remove the written data from the buffer */ *buf_size -= nwrite; memmove(buf, buf + nwrite, *buf_size); - } else if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + } else if(should_retry(errno)) { /* nothing written, try again later */ } else { _alpm_log(handle, ALPM_LOG_ERROR, @@ -530,7 +540,7 @@ static int _alpm_chroot_read_from_child(alpm_handle_t *handle, int fd, _alpm_chroot_process_output(handle, buf); } return -1; - } else if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) { + } else if(should_retry(errno)) { /* nothing read, try again */ } else { /* read error */ |