summaryrefslogtreecommitdiffstats
path: root/common/textfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/textfile.c')
-rw-r--r--common/textfile.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/textfile.c b/common/textfile.c
index bb55109c..84a72b3c 100644
--- a/common/textfile.c
+++ b/common/textfile.c
@@ -143,8 +143,10 @@ static int write_key(const char *pathname, const char *key, const char *value)
size = st.st_size;
if (!size) {
- pos = lseek(fd, size, SEEK_SET);
- err = write_key_value(fd, key, value);
+ if (value) {
+ pos = lseek(fd, size, SEEK_SET);
+ err = write_key_value(fd, key, value);
+ }
goto unlock;
}