diff options
-rw-r--r-- | install_lib.pl | 14 | ||||
-rwxr-xr-x | installman | 16 | ||||
-rwxr-xr-x | installperl | 14 |
3 files changed, 15 insertions, 29 deletions
diff --git a/install_lib.pl b/install_lib.pl index 308af70ed6..1fe25794a2 100644 --- a/install_lib.pl +++ b/install_lib.pl @@ -127,4 +127,18 @@ sub samepath { } } +sub safe_rename { + my($from,$to) = @_; + if (-f $to and not unlink($to)) { + my($i); + for ($i = 1; $i < 50; $i++) { + last if rename($to, "$to.$i"); + } + warn("Cannot rename to '$to.$i': $!"), return 0 + if $i >= 50; # Give up! + } + link($from,$to) || return 0; + unlink($from); +} + 1; diff --git a/installman b/installman index 4f9d469f6b..adb76f86e1 100755 --- a/installman +++ b/installman @@ -159,7 +159,7 @@ sub pod2man { print " $xmanpage\n" unless $opts{silent}; if (!$opts{notify} && $parser->parse_from_file($mod, $tmp)) { if (-s $tmp) { - if (rename($tmp, $manpage)) { + if (safe_rename($tmp, $manpage)) { $packlist->{$xmanpage} = { type => 'file' }; next; } @@ -172,20 +172,6 @@ sub pod2man { $packlist->write() unless $opts{notify}; print " Installation complete\n" if $opts{verbose}; -sub rename { - my($from,$to) = @_; - if (-f $to and not unlink($to)) { - my($i); - for ($i = 1; $i < 50; $i++) { - last if CORE::rename($to, "$to.$i"); - } - warn("Cannot rename to '$to.$i': $!"), return 0 - if $i >= 50; # Give up! - } - link($from,$to) || return 0; - unlink($from); -} - # Local variables: # cperl-indent-level: 4 # indent-tabs-mode: nil diff --git a/installperl b/installperl index 9cf7d7b663..f71243f05f 100755 --- a/installperl +++ b/installperl @@ -625,20 +625,6 @@ sub safe_unlink { } } -sub safe_rename { - my($from,$to) = @_; - if (-f $to and not unlink($to)) { - my($i); - for ($i = 1; $i < 50; $i++) { - last if rename($to, "$to.$i"); - } - warn("Cannot rename to '$to.$i': $!"), return 0 - if $i >= 50; # Give up! - } - link($from,$to) || return 0; - unlink($from); -} - sub copy { my($from,$to) = @_; |