Skip to content

Commit c03d3ae

Browse files
committed
add a disk_free_space check before writing config
Signed-off-by: Simon L <szaimen@e.mail.de>
1 parent 936f634 commit c03d3ae

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/private/Config.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ private function writeData() {
290290
throw new \Exception(sprintf('Could not acquire an exclusive lock on the config file %s', $this->configFilePath));
291291
}
292292

293+
// Never write file back if disk space should be low (less than 100 KiB)
294+
$df = disk_free_space($this->configDir);
295+
if ($df !== false && (int)$df < 102400) {
296+
throw new \Exception($this->configDir . " does not have enough space for writing the config file! Not writing it back!");
297+
}
298+
293299
// Write the config and release the lock
294300
ftruncate($filePointer, 0);
295301
fwrite($filePointer, $content);

0 commit comments

Comments
 (0)