Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F149406473
D52588.1790039312.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
788 B
Referenced Files
None
Subscribers
None
D52588.1790039312.diff
View Options
diff --git a/usr.sbin/pw/cpdir.c b/usr.sbin/pw/cpdir.c
--- a/usr.sbin/pw/cpdir.c
+++ b/usr.sbin/pw/cpdir.c
@@ -36,10 +36,10 @@
#include "pw.h"
void
-copymkdir(int rootfd, char const * dir, int skelfd, mode_t mode, uid_t uid,
+copymkdir(int rootfd, char const *dir, int skelfd, mode_t mode, uid_t uid,
gid_t gid, int flags)
{
- char *p, lnk[MAXPATHLEN], copybuf[4096];
+ char *p, lnk[MAXPATHLEN];
int len, homefd, srcfd, destfd;
ssize_t sz;
struct stat st;
@@ -120,8 +120,12 @@
continue;
}
- while ((sz = read(srcfd, copybuf, sizeof(copybuf))) > 0)
- write(destfd, copybuf, sz);
+ do {
+ sz = copy_file_range(srcfd, NULL, destfd, NULL,
+ SSIZE_MAX, 0);
+ } while (sz > 0);
+ if (sz < 0)
+ warn("copy_file_range");
close(srcfd);
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 22, 1:08 AM (10 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29837851
Default Alt Text
D52588.1790039312.diff (788 B)
Attached To
Mode
D52588: pw: Use copy_file_range() when copying skeleton files
Attached
Detach File
Event Timeline
Log In to Comment