summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/textfile.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/common/textfile.c b/common/textfile.c
index ca6f08f3..08cd5a9f 100644
--- a/common/textfile.c
+++ b/common/textfile.c
@@ -75,18 +75,15 @@ static int create_dirs(char *filename, mode_t mode)
return 0;
}
-static int write_key_value(int fd, char *key, char *value)
+static inline int write_key_value(int fd, char *key, char *value)
{
char *str;
- int size, err = 0;
-
- /* This check is needed, because other it will segfault */
- if (strlen(value) == 9)
- return -EIO;
+ size_t size;
+ int err = 0;
size = strlen(key) + strlen(value) + 2;
- str = malloc(size);
+ str = malloc(size + 1);
if (!str)
return ENOMEM;