Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160611313
D40898.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
882 B
Referenced Files
None
Subscribers
None
D40898.diff
View Options
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -1300,6 +1300,7 @@
static size_t bufsize;
int nr, nw;
int serrno;
+ ssize_t ret;
char *p;
int done_copy;
DIGEST_CTX ctx;
@@ -1310,6 +1311,26 @@
if (lseek(to_fd, (off_t)0, SEEK_SET) == (off_t)-1)
err(EX_OSERR, "lseek: %s", to_name);
+ /* Try copy_file_range() if no digest is requested */
+ if (digesttype == DIGEST_NONE) {
+ ret = 1;
+ while (ret > 0) {
+ ret = copy_file_range(from_fd, NULL, to_fd, NULL,
+ SSIZE_MAX, 0);
+ }
+ if (ret == 0) {
+ /* DIGEST_NONE always returns NULL */
+ return (NULL);
+ }
+ if (errno != EINVAL) {
+ serrno = errno;
+ (void)unlink(to_name);
+ errno = serrno;
+ err(EX_OSERR, "%s", to_name);
+ }
+ /* Fall back */
+ }
+
digest_init(&ctx);
done_copy = 0;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jun 27, 4:52 AM (12 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34382181
Default Alt Text
D40898.diff (882 B)
Attached To
Mode
D40898: copy_file_range() support for install(1)
Attached
Detach File
Event Timeline
Log In to Comment