If running resolvconf fails handle() fails release() is not called, which
might leave an interface file on the system (or depending on which script
called by resolvconf actually failed even the installed DNS server).
bool install)
{
char cmd[128];
- bool success = TRUE;
/* we use the nameserver's IP address as part of the interface name to
* make them unique */
if (install)
{
FILE *out;
+ bool success;
out = popen(cmd, "w");
if (!out)
DBG1(DBG_IKE, "installing DNS server %H via resolvconf", addr);
fprintf(out, "nameserver %H\n", addr);
success = !ferror(out);
- if (pclose(out))
+ if (pclose(out) || !success)
{
+ invoke_resolvconf(this, server, addr, FALSE);
return FALSE;
}
}
{
ignore_result(system(cmd));
}
- return success;
+ return TRUE;
}
METHOD(attribute_handler_t, handle, bool,