From a83602e84aa317e98db3bc1684438d120fe2d650 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 6 Jul 2015 13:51:45 -0300 Subject: [PATCH] Make sure temporary config file is safe on disk before rename, ticket #4803 --- etc/inc/config.lib.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index dedb3accb2..ad9300e900 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -486,7 +486,7 @@ function safe_write_file($file, $content, $force_binary) { fflush($fd); fclose($fd); - if (!rename($tmp_file, $file)) { + if (!pfSense_fsync($tmp_file) || !rename($tmp_file, $file)) { // Unable to move temporary file to original @unlink($tmp_file); return false;