summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2011-05-30 13:11:03 +0000
committerErmal <eri@pfsense.org>2011-05-30 13:11:03 +0000
commitd97ff036ab05751ea499553792e0ae5fc73fb3f6 (patch)
tree97830e540ebbe2125b0df400a399652a3e4d0e48
parentb45babaeb55ac039f498d13ce556f2d04d4db1f4 (diff)
downloadpfsense-d97ff036ab05751ea499553792e0ae5fc73fb3f6.zip
pfsense-d97ff036ab05751ea499553792e0ae5fc73fb3f6.tar.gz
Prevent races on resovlconf generation as well by adding a lock.
-rw-r--r--etc/inc/system.inc7
1 files changed, 6 insertions, 1 deletions
diff --git a/etc/inc/system.inc b/etc/inc/system.inc
index 347de9b..72b2e0d 100644
--- a/etc/inc/system.inc
+++ b/etc/inc/system.inc
@@ -116,9 +116,12 @@ function system_resolvconf_generate($dynupdate = false) {
}
}
+ $dnslock = lock('resolvconf', LOCK_EX);
+
$fd = fopen("{$g['varetc_path']}/resolv.conf", "w");
if (!$fd) {
printf("Error: cannot open resolv.conf in system_resolvconf_generate().\n");
+ unlock($dnslock);
return 1;
}
@@ -148,7 +151,9 @@ function system_resolvconf_generate($dynupdate = false) {
}
}
}
-
+
+ unlock($dnslock);
+
return 0;
}
OpenPOWER on IntegriCloud