diff options
author | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-11-11 22:35:18 +0000 |
---|---|---|
committer | Reinhard Kotucha <reinhard.kotucha@web.de> | 2007-11-11 22:35:18 +0000 |
commit | 3005247e2c1ff3be0b9c184c43f1f0aee1bc9e95 (patch) | |
tree | 158bb0fae637a28a451ad43906f9fd5bfb7f3c86 /Master | |
parent | e8f1002bab49cb883c60200e0ce3c7aa8d67a085 (diff) |
TLUtils.pm: fixed permissions in copy().
git-svn-id: svn://tug.org/texlive/trunk@5404 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index a4144fa0d8a..4f8e467ee37 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -413,11 +413,8 @@ on UNIX systems. On Windows, C<(-l $file)> will certainly never return 'C<true>' and symlinks will be copied as regular files. C<copy> invokes C<mkdirhier> if target directories do not exist. -These directories are created with mode C<0755>. Because the files -are copied from a read-only media with all write permissions removed, -the write flag is set for the current user, quite similar to - - chmod u+w $target_dir/`basename $file` +Files have mode C<0777>-I<umask> if they are execuatble and +C<0666>-I<umask> otherwise. =cut @@ -433,9 +430,6 @@ sub copy { my $dirmode=0755; my $blocksize=2048; - @stat=lstat "$infile"; - $mode=$stat[2]; - mkdirhier ("$destdir") unless -d "$destdir"; $filename=basename "$infile"; @@ -448,7 +442,10 @@ sub copy { or die "Can't open '$infile': $!\n"; binmode IN; - sysopen OUT, "$outfile", (O_CREAT|O_WRONLY) + $mode=(-x "$infile")? oct("0777"):oct("0666"); + $mode-=umask; + + sysopen OUT, "$outfile", (O_CREAT|O_WRONLY), $mode or die "Can't open '$outfile': $!\n"; binmode OUT; @@ -464,6 +461,7 @@ sub copy { } close OUT; close IN; + @stat=lstat "$infile"; utime $stat[8], $stat[9], "$outfile"; } } |