From 8008038a816c97ca91747fd203abbf4886e9b98b Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sat, 21 Apr 2007 20:08:21 +0000 Subject: * Use copy instead of system() * Lock the configuration before doing this operation * Unlink config.cache if it exists * Send the image to RO after this operation --- etc/inc/config.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'etc/inc/config.inc') diff --git a/etc/inc/config.inc b/etc/inc/config.inc index b29b210..e71b489 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -297,11 +297,15 @@ function discover_last_backup() { } function restore_backup($file) { + config_lock(); if(file_exists($file)) { conf_mount_rw(); - system("cp $file /cf/conf/config.xml"); + copy("$file /cf/conf/config.xml"); + unlink_if_exists("/tmp/config.cache"); + log_error("pfSense is restoring the configuration $file"); + conf_mount_ro(); } - log_error("pfSense is restoring the configuration $file"); + config_unlock(); } /****f* config/parse_config_bootup -- cgit v1.1