rc_service_value_set: remove the option if NULL is the value
This allows the equivalent of "unsetting" a value for a service.
This commit is contained in:
parent
6f3e2e2d7d
commit
cf429ee359
@ -894,11 +894,14 @@ rc_service_value_set(const char *service, const char *option,
|
||||
return false;
|
||||
|
||||
snprintf(p, sizeof(file) - (p - file), "/%s", option);
|
||||
if (value) {
|
||||
if (!(fp = fopen(file, "w")))
|
||||
return false;
|
||||
if (value)
|
||||
fprintf(fp, "%s", value);
|
||||
fclose(fp);
|
||||
} else {
|
||||
unlink(file);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
librc_hidden_def(rc_service_value_set)
|
||||
|
Loading…
Reference in New Issue
Block a user