mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-12 03:00:28 +00:00
71b1571733
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)
30 lines
677 B
Plaintext
30 lines
677 B
Plaintext
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)
|