From: Amick, Eric Date: Mon, 9 Jun 2003 15:48:09 +0000 (+0000) Subject: [perl #22622] Bogus error codes from File::Copy::move X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa76202e3aa22e9755f1a461416769c368b47afc;p=p5sagit%2Fp5-mst-13.2.git [perl #22622] Bogus error codes from File::Copy::move From: "Amick, Eric" (via RT) Message-ID: p4raw-id: //depot/perl@19799 --- diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm index 5c5f0f3..fb256c0 100644 --- a/lib/File/Copy.pm +++ b/lib/File/Copy.pm @@ -180,7 +180,7 @@ sub copy { sub move { my($from,$to) = @_; - my($copied,$fromsz,$tosz1,$tomt1,$tosz2,$tomt2,$sts,$ossts); + my($fromsz,$tosz1,$tomt1,$tosz2,$tomt2,$sts,$ossts); if (-d $to && ! -d $from) { $to = _catname($from, $to); @@ -194,7 +194,6 @@ sub move { } return 1 if rename $from, $to; - ($sts,$ossts) = ($! + 0, $^E + 0); # Did rename return an error even though it succeeded, because $to # is on a remote NFS file system, and NFS lost the server's ack? return 1 if defined($fromsz) && !-e $from && # $from disappeared @@ -203,7 +202,8 @@ sub move { $tosz2 == $fromsz; # it's all there ($tosz1,$tomt1) = (stat($to))[7,9]; # just in case rename did something - return 1 if ($copied = copy($from,$to)) && unlink($from); + return 1 if copy($from,$to) && unlink($from); + ($sts,$ossts) = ($! + 0, $^E + 0); ($tosz2,$tomt2) = ((stat($to))[7,9],0,0) if defined $tomt1; unlink($to) if !defined($tomt1) or $tomt1 != $tomt2 or $tosz1 != $tosz2;