mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
Merge pull request #70 from thiell/sendfile-minorfix
copyup: minor fixes for sendfile()
This commit is contained in:
commit
89bd69ba91
3
main.c
3
main.c
@ -2093,13 +2093,14 @@ copyup (struct ovl_data *lo, struct ovl_node *node)
|
|||||||
while (copied < st.st_size)
|
while (copied < st.st_size)
|
||||||
{
|
{
|
||||||
off_t tocopy = st.st_size - copied;
|
off_t tocopy = st.st_size - copied;
|
||||||
ssize_t n = sendfile (dfd, sfd, NULL, tocopy > SIZE_MAX ? SIZE_MAX : (size_t) tocopy);
|
ssize_t n = TEMP_FAILURE_RETRY (sendfile (dfd, sfd, NULL, tocopy > SIZE_MAX ? SIZE_MAX : (size_t) tocopy));
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
/* On failure, fallback to the read/write loop. */
|
/* On failure, fallback to the read/write loop. */
|
||||||
ret = copy_fd_to_fd (sfd, dfd, buf, buf_size);
|
ret = copy_fd_to_fd (sfd, dfd, buf, buf_size);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto exit;
|
goto exit;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
copied += n;
|
copied += n;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user