Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F159697737
D52588.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
788 B
Referenced Files
None
Subscribers
None
D52588.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
Thu, Jun 18, 4:32 AM (4 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34045384
Default Alt Text
D52588.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