Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115217036
D26377.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.diff
View Options
Index: head/bin/cp/utils.c
===================================================================
--- head/bin/cp/utils.c
+++ head/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, Apr 22, 12:53 PM (7 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17704601
Default Alt Text
D26377.diff (1 KB)
Attached To
Mode
D26377: cp: use copy_file_range(2)
Attached
Detach File
Event Timeline
Log In to Comment