Page MenuHomeFreeBSD

D55167.id171422.diff
No OneTemporary

D55167.id171422.diff

diff --git a/bin/cp/utils.c b/bin/cp/utils.c
--- a/bin/cp/utils.c
+++ b/bin/cp/utils.c
@@ -104,7 +104,7 @@
struct stat sb, *fs;
ssize_t wcount;
off_t wtotal;
- int ch, checkch, from_fd, rval, to_fd;
+ int ch, checkch, from_fd, rval, serrno, to_fd;
bool use_copy_file_range = true;
fs = entp->fts_statp;
@@ -216,15 +216,18 @@
if (!use_copy_file_range) {
wcount = copy_fallback(from_fd, to_fd);
}
- wtotal += wcount;
+ if (wcount >= 0)
+ wtotal += wcount;
if (info) {
info = 0;
+ serrno = errno;
(void)fprintf(stderr,
"%s -> %s%s %3d%%\n",
entp->fts_path, to.base, to.path,
cp_pct(wtotal, fs->st_size));
+ errno = serrno;
}
- } while (wcount > 0);
+ } while (wcount > 0 || (wcount < 0 && errno == EINTR));
if (wcount < 0) {
warn("%s", entp->fts_path);
rval = 1;

File Metadata

Mime Type
text/plain
Expires
Sun, Jun 14, 7:45 AM (6 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33945442
Default Alt Text
D55167.id171422.diff (837 B)

Event Timeline