Author: kientzle Date: Tue May 18 14:11:38 2010 New Revision: 208263 URL: http://svn.freebsd.org/changeset/base/208263
Log: Retry reads that fail with EINTR. This fixes a problem with bsdtar failing on SIGINT. Modified: head/lib/libarchive/archive_read_open_fd.c head/lib/libarchive/archive_read_open_filename.c Modified: head/lib/libarchive/archive_read_open_fd.c ============================================================================== --- head/lib/libarchive/archive_read_open_fd.c Tue May 18 10:32:20 2010 (r208262) +++ head/lib/libarchive/archive_read_open_fd.c Tue May 18 14:11:38 2010 (r208263) @@ -116,11 +116,15 @@ file_read(struct archive *a, void *clien 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 Modified: head/lib/libarchive/archive_read_open_filename.c ============================================================================== --- head/lib/libarchive/archive_read_open_filename.c Tue May 18 10:32:20 2010 (r208262) +++ head/lib/libarchive/archive_read_open_filename.c Tue May 18 14:11:38 2010 (r208263) @@ -160,15 +160,19 @@ file_read(struct archive *a, void *clien ssize_t bytes_read; *buff = mine->buffer; - bytes_read = read(mine->fd, mine->buffer, mine->block_size); - if (bytes_read < 0) { - if (mine->filename[0] == '\0') - archive_set_error(a, errno, "Error reading stdin"); - else - archive_set_error(a, errno, "Error reading '%s'", - mine->filename); + for (;;) { + bytes_read = read(mine->fd, mine->buffer, mine->block_size); + if (bytes_read < 0) { + if (errno == EINTR) + continue; + else if (mine->filename[0] == '\0') + archive_set_error(a, errno, "Error reading stdin"); + else + archive_set_error(a, errno, "Error reading '%s'", + mine->filename); + } + return (bytes_read); } - return (bytes_read); } #if ARCHIVE_API_VERSION < 2 _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"