From: Orgad Shaneh Date: Sun, 31 Jul 2016 06:18:22 +0000 (+0300) Subject: mklink: Do not needlessly overwrite linked files... X-Git-Tag: OpenSSL_1_0_2k~36 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7a9d7128d87d1572a0b7f99ff7b19d704395c8db;p=oweals%2Fopenssl.git mklink: Do not needlessly overwrite linked files... ... on systems with symlinks. Creating or overwriting a symlink sets the file ctime to the current time. This causes needless rebuilds because the time of all the headers is changed, and apparently make considers the link's time rather than the time of the target. Reviewed-by: Rich Salz Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/1370) --- diff --git a/util/mklink.pl b/util/mklink.pl index 2df0453a17..a937606ea5 100755 --- a/util/mklink.pl +++ b/util/mklink.pl @@ -55,8 +55,10 @@ if ($^O eq "msys") { $symlink_exists=0 }; foreach $file (@files) { my $err = ""; if ($symlink_exists) { - unlink "$from/$file"; - symlink("$to/$file", "$from/$file") or $err = " [$!]"; + if (!-l "$from/$file") { + unlink "$from/$file"; + symlink("$to/$file", "$from/$file") or $err = " [$!]"; + } } elsif (-d "$from" && (!-f "$from/$file" || ((stat("$file"))[9] > (stat("$from/$file"))[9]))) { unlink "$from/$file"; open (OLD, "<$file") or die "Can't open $file: $!";