Skip to content

Commit

Permalink
Fix chmod() calls to apply umask
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Apr 19, 2012
1 parent 13c07d1 commit 5c059aa
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Expand Up @@ -181,7 +181,7 @@ static private function writeCacheFile($file, $content)
{
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0777);
chmod($file, 0666 ^ umask());

return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Config/ConfigCache.php
Expand Up @@ -101,7 +101,7 @@ public function write($content, array $metadata = null)

$tmpFile = tempnam(dirname($this->file), basename($this->file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $this->file)) {
chmod($this->file, 0666);
chmod($this->file, 0666 ^ umask());
} else {
throw new \RuntimeException(sprintf('Failed to write cache file "%s".', $this->file));
}
Expand All @@ -110,7 +110,7 @@ public function write($content, array $metadata = null)
$file = $this->file.'.meta';
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, serialize($metadata)) && @rename($tmpFile, $file)) {
chmod($file, 0666);
chmod($file, 0666 ^ umask());
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpFoundation/File/File.php
Expand Up @@ -122,7 +122,7 @@ public function move($directory, $name = null)
throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
}

chmod($target, 0666);
chmod($target, 0666 ^ umask());

return new File($target);
}
Expand Down
Expand Up @@ -22,7 +22,7 @@ protected function writeCacheFile($file, $content)
{
$tmpFile = tempnam(dirname($file), basename($file));
if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) {
chmod($file, 0644);
chmod($file, 0666 ^ umask());

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpKernel/HttpCache/Store.php
Expand Up @@ -332,7 +332,7 @@ private function save($key, $data)
return false;
}

chmod($path, 0644);
chmod($path, 0666 ^ umask());
}

public function getPath($key)
Expand Down

0 comments on commit 5c059aa

Please sign in to comment.