From a558c9ab3c6398812abfc2ba9bcd1b9d201f1d0c Mon Sep 17 00:00:00 2001 From: Stephane Thiell Date: Thu, 2 May 2019 11:57:50 -0700 Subject: [PATCH] copyup: minor fixes for sendfile() --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 3841d01..72b7532 100644 --- a/main.c +++ b/main.c @@ -2093,13 +2093,14 @@ copyup (struct ovl_data *lo, struct ovl_node *node) while (copied < st.st_size) { 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) { /* On failure, fallback to the read/write loop. */ ret = copy_fd_to_fd (sfd, dfd, buf, buf_size); if (ret < 0) goto exit; + break; } copied += n; }