mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
Set permissions when saving files
Fixes https://github.com/elrido/ZeroBin/issues/80
This commit is contained in:
parent
6bb81d779e
commit
8a48e9ce78
@ -116,6 +116,7 @@ abstract class persistence
|
|||||||
self::_initialize();
|
self::_initialize();
|
||||||
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
$file = self::$_path . DIRECTORY_SEPARATOR . $filename;
|
||||||
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
$writtenBytes = @file_put_contents($file, $data, LOCK_EX);
|
||||||
|
chmod($file, 0640); // protect file access
|
||||||
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
if ($writtenBytes === false || $writtenBytes < strlen($data)) {
|
||||||
throw new Exception('unable to write to file ' . $file, 13);
|
throw new Exception('unable to write to file ' . $file, 13);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user