aboutsummaryrefslogtreecommitdiff
path: root/src/librc
diff options
context:
space:
mode:
Diffstat (limited to 'src/librc')
-rw-r--r--src/librc/librc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/librc/librc.c b/src/librc/librc.c
index 84c76b5a..ee65b00a 100644
--- a/src/librc/librc.c
+++ b/src/librc/librc.c
@@ -894,12 +894,15 @@ rc_service_value_set(const char *service, const char *option,
return false;
snprintf(p, sizeof(file) - (p - file), "/%s", option);
- if (!(fp = fopen(file, "w")))
- return false;
- if (value)
+ if (value) {
+ if (!(fp = fopen(file, "w")))
+ return false;
fprintf(fp, "%s", value);
- fclose(fp);
- return true;
+ fclose(fp);
+ } else {
+ unlink(file);
+ }
+ return true;
}
librc_hidden_def(rc_service_value_set)