From 06647572b041d2b9ee3087793f7d56668840eefa Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 14 Jul 2013 11:44:20 +0200 Subject: [PATCH] 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. --- install_lib.pl | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/install_lib.pl b/install_lib.pl index 0a63574..aa9945a 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 { -- 2.7.4