diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-03-20 20:50:02 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-03-20 20:50:02 +0000 |
commit | 336cb718b10ff053b119216cdd68f832271a175c (patch) | |
tree | c8c51b290db757a7b84b4196c37d5ed038a93a2b /etc/inc/util.inc | |
parent | 777853c79e29b49348c1321ba37bd5a076c21783 (diff) | |
download | pfsense-336cb718b10ff053b119216cdd68f832271a175c.zip pfsense-336cb718b10ff053b119216cdd68f832271a175c.tar.gz |
If glob does not return an array, deal with the single filename.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 51bb46f..b555115 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -287,10 +287,13 @@ function mwexec_bg($command) { /* unlink a file, if it exists */ function unlink_if_exists($fn) { - %filename = $fn; -// foreach(glob($fn) as $filename) { - if (file_exists($filename)) unlink($filename); -// } + $to_do = glob($fn); + if(is_array($to_do) { + foreach($to_do as $filename) + if (file_exists($filename)) unlink($filename); + } else { + if (file_exists($to_do)) unlink($to_do); + } } /* make a global alias table (for faster lookups) */ |