mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 18:14:42 +00:00
system: stop using a lock around resolv.conf handling #2267
This might kill a bit of delay in function use by doing an atomic move to update resolv.conf. Even if several instances are running at the same time the contents of the file will be the same now. I don't expect issues with the DNS route updates either: even if they are removed or added twice, they will always end up being there.
This commit is contained in:
parent
ab75fbb673
commit
5f4315c40c
@ -179,10 +179,11 @@ function system_resolvconf_generate($verbose = false)
|
||||
}
|
||||
}
|
||||
|
||||
$dnslock = lock('resolvconf', LOCK_EX);
|
||||
$tempfile = tempnam('/tmp', 'resolv.conf');
|
||||
file_put_contents($tempfile, $resolvconf);
|
||||
chmod($tempfile, 0644);
|
||||
|
||||
file_put_contents('/etc/resolv.conf', $resolvconf);
|
||||
chmod('/etc/resolv.conf', 0644);
|
||||
rename($tempfile, '/etc/resolv.conf');
|
||||
|
||||
/* setup static routes for DNS servers. */
|
||||
$gateways = new \OPNsense\Routing\Gateways(legacy_interfaces_details());
|
||||
@ -207,8 +208,6 @@ function system_resolvconf_generate($verbose = false)
|
||||
}
|
||||
}
|
||||
|
||||
unlock($dnslock);
|
||||
|
||||
if ($verbose) {
|
||||
echo "done.\n";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user