From: Stig Bakken Date: Mon, 17 Nov 2003 02:27:23 +0000 (+0000) Subject: * "chmod +x" when extracting archived executable files X-Git-Tag: php-5.0.0b3RC1~673 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c67848319a415103c807695e1da88021590a268a;p=php * "chmod +x" when extracting archived executable files --- diff --git a/pear/Archive/Tar.php b/pear/Archive/Tar.php index 9176083750..2e7848a9d3 100644 --- a/pear/Archive/Tar.php +++ b/pear/Archive/Tar.php @@ -1367,8 +1367,11 @@ class Archive_Tar extends PEAR // ----- Change the file mode, mtime @touch($v_header['filename'], $v_header['mtime']); - // To be completed - //chmod($v_header[filename], DecOct($v_header[mode])); + if ($v_header['mode'] & 0111) { + // make file executable, obey umask + $mode = fileperms($v_header['filename']) | (~umask() & 0111); + @chmod($v_header['filename'], $mode); + } } // ----- Check the file size