From 8bc26371882b7ebaaa25ca0c2ce81b1f719daeea Mon Sep 17 00:00:00 2001 From: Eduardo Rocha Date: Fri, 24 Mar 2006 14:36:27 +0000 Subject: Fix a SEGFAULT that happens when textfile_del is called using an empty file. --- common/textfile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common/textfile.c') 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; } -- cgit