summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@sullrich-MacBookPro.geekgod.com>2009-05-16 23:56:35 -0400
committerScott Ullrich <sullrich@sullrich-MacBookPro.geekgod.com>2009-05-16 23:56:35 -0400
commit09af04fb91d8c595a643d35b6649374232b8c220 (patch)
treea16a9d60f774c3ef54e046d8bbddcdb386d66977 /etc
parente4fcf99bab4ea2f088da808a25f94e54ab9031da (diff)
downloadpfsense-09af04fb91d8c595a643d35b6649374232b8c220.zip
pfsense-09af04fb91d8c595a643d35b6649374232b8c220.tar.gz
Rely on our own error handling
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/util.inc35
1 files changed, 21 insertions, 14 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index 6ee7072..b318f92 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -90,21 +90,28 @@ function config_unlock() {
function lock($lock) {
global $g, $cfglckkeyconsumers;
- if (!$lock)
- die("WARNING: You must give a name as parameter to lock() function.");
+ if (!$lock)
+ die("WARNING: You must give a name as parameter to lock() function.");
if (!file_exists("{$g['tmp_path']}/{$lock}.lock"))
- @touch("{$g['tmp_path']}/{$lock}.lock");
- $config_lock_key = ftok("{$g['tmp_path']}/{$lock}.lock", 'a');
- $cfglckkey = sem_get($config_lock_key, 1);
- $cfglckkeyconsumers++;
- if (!sem_acquire($cfglckkey)) {
- log_error("WARNING: lock() - Could not acquire {$lock} lock!");
- sem_remove($cfglckkey);
- return NULL;
- } else if ($g['debug'])
- log_error("lock() - Got {$file} lock.");
+ @touch("{$g['tmp_path']}/{$lock}.lock");
+
+ $config_lock_key = ftok("{$g['tmp_path']}/{$lock}.lock", 'a');
+ $cfglckkey = sem_get($config_lock_key, 1);
+ $cfglckkeyconsumers++;
+
+ // Rely on or own logging for errors here.
+ ini_set('error_reporting', E_NONE);
+
+ if (!sem_acquire($cfglckkey)) {
+ log_error("WARNING: lock() - Could not acquire {$lock} lock!");
+ sem_remove($cfglckkey);
+ return NULL;
+ } else if ($g['debug'])
+ log_error("lock() - Got {$file} lock.");
+
+ ini_set('error_reporting', E_ALL & ~E_NOTICE);
- return $cfglckkey;
+ return $cfglckkey;
}
/* unlock configuration file */
@@ -960,4 +967,4 @@ function is_interface_mismatch() {
return $do_assign;
}
-?>
+?> \ No newline at end of file
OpenPOWER on IntegriCloud