summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-05-28 20:21:07 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-05-28 20:21:07 +0000
commit985777a996e880e5c56185272852a3da184fcdd4 (patch)
tree2d8a3ecc0e39d3f8849fa77e148dc41b5ef764e2
parentc22ed41f69a365910bc1e00be29475a6c7be37ec (diff)
downloadperl-985777a996e880e5c56185272852a3da184fcdd4.tar.gz
close open file before chmod() (from Rocco Caputo <troc@netrus.net>)
p4raw-id: //depot/perl@6148
-rw-r--r--lib/ExtUtils/MM_Unix.pm16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
index da2255271f..65b0bd91c4 100644
--- a/lib/ExtUtils/MM_Unix.pm
+++ b/lib/ExtUtils/MM_Unix.pm
@@ -1249,11 +1249,6 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
next;
}
my($dev,$ino,$mode) = stat FIXIN;
- # If they override perm_rwx, we won't notice it during fixin,
- # because fixin is run through a new instance of MakeMaker.
- # That is why we must run another CHMOD later.
- $mode = oct($self->perm_rwx) unless $dev;
- chmod $mode, $file;
# Print out the new #! line (or equivalent).
local $\;
@@ -1261,7 +1256,15 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
print FIXOUT $shb, <FIXIN>;
close FIXIN;
close FIXOUT;
- # can't rename open files on some DOSISH platforms
+
+ # can't rename/chmod open files on some DOSISH platforms
+
+ # If they override perm_rwx, we won't notice it during fixin,
+ # because fixin is run through a new instance of MakeMaker.
+ # That is why we must run another CHMOD later.
+ $mode = oct($self->perm_rwx) unless $dev;
+ chmod $mode, $file;
+
unless ( rename($file, "$file.bak") ) {
warn "Can't rename $file to $file.bak: $!";
next;
@@ -1276,6 +1279,7 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}'
}
unlink "$file.bak";
} continue {
+ close(FIXIN) if fileno(FIXIN);
chmod oct($self->perm_rwx), $file or
die "Can't reset permissions for $file: $!\n";
system("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';;