summaryrefslogtreecommitdiffstats
path: root/common/textfile.c
diff options
context:
space:
mode:
authorEduardo Rocha <eduardo.rocha@openbossa.org>2006-03-24 14:36:27 +0000
committerEduardo Rocha <eduardo.rocha@openbossa.org>2006-03-24 14:36:27 +0000
commit8bc26371882b7ebaaa25ca0c2ce81b1f719daeea (patch)
tree8177d4e9e2e3bdeca83dd835f9dc3fcbd90ffedc /common/textfile.c
parentb357f1d3900bca5575e88fcfc160945c6088608c (diff)
Fix a SEGFAULT that happens when textfile_del is called using an empty file.
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;
}