summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/config.lib.inc
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-12-20 18:55:26 +0545
committerPhil Davis <phil.davis@inf.org>2015-12-20 18:55:26 +0545
commit61ee7f137b50f147ac7b6da516a487f6c156d988 (patch)
tree483a57a3c0285c6a4754cfef812bb5c2926dc201 /src/etc/inc/config.lib.inc
parent72eaefaf1fc991d5949daadbac5ae50ed1d3ad5f (diff)
downloadpfsense-61ee7f137b50f147ac7b6da516a487f6c156d988.zip
pfsense-61ee7f137b50f147ac7b6da516a487f6c156d988.tar.gz
Redmine #5613 avoid Reset to Factory Defaults PHP warnings
On Reset to Factory Defaults there are some warnings given when unlink_if_exists() tries to unlink() directories in /conf - /conf/backup and /conf/sshd. unlink does not work on directories. This PR avoids the PHP warnings by not trying to remove the directories inside /conf. As has been the case before this PR, the following things are thus left on the system after Reset to Factory Defaults: /conf/backup - old config backups, which contain configs of the previous system. /conf/sshd - old ssh keys. For testing, this is handy. But for real "reset" should these be deleted? In addition to this PR, should there be code to delete everything in /conf/backup and/or /conf/sshd?
Diffstat (limited to 'src/etc/inc/config.lib.inc')
-rw-r--r--src/etc/inc/config.lib.inc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc
index 62763b0..e5b50ed 100644
--- a/src/etc/inc/config.lib.inc
+++ b/src/etc/inc/config.lib.inc
@@ -618,7 +618,7 @@ function reset_factory_defaults($lock = false) {
/* clear out /conf */
$dh = opendir($g['conf_path']);
while ($filename = readdir($dh)) {
- if (($filename != ".") && ($filename != "..")) {
+ if (($filename != ".") && ($filename != "..") && (!is_dir($g['conf_path'] . "/" . $filename))) {
unlink_if_exists($g['conf_path'] . "/" . $filename);
}
}
OpenPOWER on IntegriCloud