mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-18 10:35:55 +00:00
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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=224700
@ -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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
for (;;) {
|
||||
bytesWritten = fwrite(buff, 1, length, mine->f);
|
||||
if (bytesWritten < length) {
|
||||
if (bytesWritten <= 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
archive_set_error(a, errno, "Write error");
|
||||
return (-1);
|
||||
}
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user