Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109860247
D26377.id76819.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D26377.id76819.diff
View Options
Index: bin/cp/utils.c
===================================================================
--- bin/cp/utils.c
+++ bin/cp/utils.c
@@ -212,27 +212,16 @@
err(1, "Not enough memory");
}
wtotal = 0;
- while ((rcount = read(from_fd, buf, bufsize)) > 0) {
- for (bufp = buf, wresid = rcount; ;
- bufp += wcount, wresid -= wcount) {
- wcount = write(to_fd, bufp, wresid);
- if (wcount <= 0)
- break;
- wtotal += wcount;
- if (info) {
- info = 0;
- (void)fprintf(stderr,
- "%s -> %s %3d%%\n",
- entp->fts_path, to.p_path,
- cp_pct(wtotal, fs->st_size));
- }
- if (wcount >= (ssize_t)wresid)
- break;
- }
- if (wcount != (ssize_t)wresid) {
- warn("%s", to.p_path);
- rval = 1;
- break;
+ while ((rcount = copy_file_range(from_fd, NULL,
+ to_fd, NULL, bufsize, 0)) > 0)
+ {
+ wtotal += rcount;
+ if (info) {
+ info = 0;
+ (void)fprintf(stderr,
+ "%s -> %s %3d%%\n",
+ entp->fts_path, to.p_path,
+ cp_pct(wtotal, fs->st_size));
}
}
if (rcount < 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Feb 11, 11:05 AM (4 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16593927
Default Alt Text
D26377.id76819.diff (1 KB)
Attached To
Mode
D26377: cp: use copy_file_range(2)
Attached
Detach File
Event Timeline
Log In to Comment