summaryrefslogtreecommitdiff
path: root/install_lib.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-07-14 11:44:20 +0200
committerNicholas Clark <nick@ccl4.org>2013-07-23 13:39:51 +0200
commit06647572b041d2b9ee3087793f7d56668840eefa (patch)
treefce6b9e709e8717f8c68cc654d318ac0edcf8fff /install_lib.pl
parentf4df373def033480516a6b0b9bd76e0182ce0024 (diff)
downloadperl-06647572b041d2b9ee3087793f7d56668840eefa.tar.gz
install_lib.pl's samepath() should not warn if $p1 does not exist.
If $p1 is a non-existent path, then the two paths can't be the same, so samepath() should promptly return false.
Diffstat (limited to 'install_lib.pl')
-rw-r--r--install_lib.pl19
1 files changed, 9 insertions, 10 deletions
diff --git a/install_lib.pl b/install_lib.pl
index 0a63574389..aa9945a2f9 100644
--- a/install_lib.pl
+++ b/install_lib.pl
@@ -111,21 +111,20 @@ sub chmod {
unless $opts{notify};
}
-
sub samepath {
my($p1, $p2) = @_;
return (lc($p1) eq lc($p2)) if ($Is_W32 || $Is_NetWare);
- if ($p1 ne $p2) {
- my($dev1, $ino1, $dev2, $ino2);
- ($dev1, $ino1) = stat($p1);
- ($dev2, $ino2) = stat($p2);
- ($dev1 == $dev2 && $ino1 == $ino2);
- }
- else {
- 1;
- }
+ return 1
+ if $p1 eq $p2;
+
+ my ($dev1, $ino1) = stat $p1;
+ return 0
+ unless defined $dev1;
+ my ($dev2, $ino2) = stat $p2;
+
+ return $dev1 == $dev2 && $ino1 == $ino2;
}
sub safe_rename {