diff options
author | kientzle <kientzle@FreeBSD.org> | 2010-05-18 14:11:38 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2010-05-18 14:11:38 +0000 |
commit | f11cb3f4b947ea3d659a1b883a71986d52f3efb7 (patch) | |
tree | d9dfb4417f8788eac18c4b1ff58b471f8d0dce57 /lib/libarchive/archive_read_open_fd.c | |
parent | 7f3f7db3798a4d71f451d4eede04bcd6f9bec96b (diff) | |
download | FreeBSD-src-f11cb3f4b947ea3d659a1b883a71986d52f3efb7.zip FreeBSD-src-f11cb3f4b947ea3d659a1b883a71986d52f3efb7.tar.gz |
Retry reads that fail with EINTR. This fixes a problem
with bsdtar failing on SIGINT.
Diffstat (limited to 'lib/libarchive/archive_read_open_fd.c')
-rw-r--r-- | lib/libarchive/archive_read_open_fd.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libarchive/archive_read_open_fd.c b/lib/libarchive/archive_read_open_fd.c index 8a7829b..90e764a 100644 --- a/lib/libarchive/archive_read_open_fd.c +++ b/lib/libarchive/archive_read_open_fd.c @@ -116,11 +116,15 @@ file_read(struct archive *a, void *client_data, const void **buff) ssize_t bytes_read; *buff = mine->buffer; - bytes_read = read(mine->fd, mine->buffer, mine->block_size); - if (bytes_read < 0) { - archive_set_error(a, errno, "Error reading fd %d", mine->fd); + for (;;) { + bytes_read = read(mine->fd, mine->buffer, mine->block_size); + if (bytes_read < 0) { + if (errno == EINTR) + continue; + archive_set_error(a, errno, "Error reading fd %d", mine->fd); + } + return (bytes_read); } - return (bytes_read); } #if ARCHIVE_API_VERSION < 2 |