Merge revision 3554 from libarchive's release/2.8 branch:
Partial merge of 2431 from trunk: Retry writes on EINTR. This should fix the SIGINT handler in bsdtar. Note: The rest of r2431 can't be merged, since it interacts with a big write-side rearchitecture. PR: bin/149409 Reviewed by: kientzle Approved by: re (kib) MFC after: 3 days
This commit is contained in:
parent
88c037e26a
commit
b837506cbc
@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include "archive.h"
|
||||
|
||||
struct write_fd_data {
|
||||
off_t offset;
|
||||
int fd;
|
||||
};
|
||||
|
||||
@ -122,12 +121,16 @@ file_write(struct archive *a, void *client_data, const void *buff, size_t length
|
||||
ssize_t bytesWritten;
|
||||
|
||||
mine = (struct write_fd_data *)client_data;
|
||||
bytesWritten = write(mine->fd, buff, length);
|
||||
if (bytesWritten <= 0) {
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
for (;;) {
|
||||
bytesWritten = write(mine->fd, buff, length);
|
||||
if (bytesWritten <= 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -86,12 +86,16 @@ file_write(struct archive *a, void *client_data, const void *buff, size_t length
|
||||
size_t bytesWritten;
|
||||
|
||||
mine = client_data;
|
||||
bytesWritten = fwrite(buff, 1, length, mine->f);
|
||||
if (bytesWritten < length) {
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
for (;;) {
|
||||
bytesWritten = fwrite(buff, 1, length, mine->f);
|
||||
if (bytesWritten <= 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -142,12 +142,16 @@ file_write(struct archive *a, void *client_data, const void *buff, size_t length
|
||||
ssize_t bytesWritten;
|
||||
|
||||
mine = (struct write_file_data *)client_data;
|
||||
bytesWritten = write(mine->fd, buff, length);
|
||||
if (bytesWritten <= 0) {
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
for (;;) {
|
||||
bytesWritten = write(mine->fd, buff, length);
|
||||
if (bytesWritten <= 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
return (bytesWritten);
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user