mirror of
https://git.freebsd.org/ports.git
synced 2025-06-07 05:40:30 -04:00
hierarchy under its own directory. This patch changes the code to attempt to link() the files instead. Should the linking fail (typically, because the source and the target may be on different filesystems), the code will still fall back to copying. The patch is submitted to the (dormant) author: http://www.epmhome.org/str.php?L21+P0+S-2+C0+I0+E0+M10+Q Approved by: maintainer (maho)
29 lines
677 B
Text
29 lines
677 B
Text
Change copy_file() function to try to create a hard link instead
|
|
of copying...
|
|
|
|
Submitted to author:
|
|
|
|
http://www.epmhome.org/str.php?L21+P0+S-2+C0+I0+E0+M10+Q
|
|
|
|
-mi
|
|
|
|
--- file.c 2006-08-29 12:43:09.000000000 -0400
|
|
+++ file.c 2009-11-16 19:49:06.242283000 -0500
|
|
@@ -67,4 +67,17 @@
|
|
|
|
unlink(dst);
|
|
+ if (link(src, dst) == 0)
|
|
+ {
|
|
+ if (Verbosity > 1)
|
|
+ printf("Successfully linked %s to %s instead of copying\n",
|
|
+ src, dst);
|
|
+ return 0;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ if (Verbosity > 1)
|
|
+ printf("Linking %s to %s failed: %s.\n\tFalling back to copying\n",
|
|
+ src, dst, strerror(errno));
|
|
+ }
|
|
|
|
if ((dstfile = fopen(dst, "wb")) == NULL)
|