diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2012-10-30 12:38:20 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2012-10-30 12:43:12 +0200 |
commit | eb23d21b3da0789c19a2e97306745be443567d41 (patch) | |
tree | 7b18468acb25e225b65e2064853a9967ad098cd0 /rpmio/rpmio.c | |
parent | cbd6ef58bbc122e6adf2138679915bd3845d6756 (diff) | |
download | librpm-tizen-eb23d21b3da0789c19a2e97306745be443567d41.tar.gz librpm-tizen-eb23d21b3da0789c19a2e97306745be443567d41.tar.bz2 librpm-tizen-eb23d21b3da0789c19a2e97306745be443567d41.zip |
Handle EINTR in Fread() and Fwrite()
- Not all systems automatically restart signal-interrupted operations,
handle this centrally since its so easy to do. Also related to
RhBug:580974.
Diffstat (limited to 'rpmio/rpmio.c')
-rw-r--r-- | rpmio/rpmio.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c index 6feae8633..725cc7478 100644 --- a/rpmio/rpmio.c +++ b/rpmio/rpmio.c @@ -1216,7 +1216,9 @@ ssize_t Fread(void *buf, size_t size, size_t nmemb, FD_t fd) fdio_read_function_t _read = FDIOVEC(fd, read); fdstat_enter(fd, FDSTAT_READ); - rc = (_read ? (*_read) (fd, buf, size * nmemb) : -2); + do { + rc = (_read ? (*_read) (fd, buf, size * nmemb) : -2); + } while (rc == -1 && errno == EINTR); fdstat_exit(fd, FDSTAT_READ, rc); if (fd->digests && rc > 0) @@ -1237,7 +1239,9 @@ ssize_t Fwrite(const void *buf, size_t size, size_t nmemb, FD_t fd) fdio_write_function_t _write = FDIOVEC(fd, write); fdstat_enter(fd, FDSTAT_WRITE); - rc = (_write ? _write(fd, buf, size * nmemb) : -2); + do { + rc = (_write ? _write(fd, buf, size * nmemb) : -2); + } while (rc == -1 && errno == EINTR); fdstat_exit(fd, FDSTAT_WRITE, rc); if (fd->digests && rc > 0) |