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,12 +894,15 @@ rc_service_value_set(const char *service, const char *option,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
snprintf(p, sizeof(file) - (p - file), "/%s", option);
|
snprintf(p, sizeof(file) - (p - file), "/%s", option);
|
||||||
if (!(fp = fopen(file, "w")))
|
if (value) {
|
||||||
return false;
|
if (!(fp = fopen(file, "w")))
|
||||||
if (value)
|
return false;
|
||||||
fprintf(fp, "%s", value);
|
fprintf(fp, "%s", value);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
return true;
|
} else {
|
||||||
|
unlink(file);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
librc_hidden_def(rc_service_value_set)
|
librc_hidden_def(rc_service_value_set)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user