Prevent races on resovlconf generation as well by adding a lock.

This commit is contained in:
Ermal 2011-05-30 13:11:03 +00:00
parent b45babaeb5
commit d97ff036ab

View File

@ -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;
}