diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-02 14:50:44 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-02 14:50:44 +0100 |
commit | d64e852a3863ba495cb3638ebe4bf1b89983a7f3 (patch) | |
tree | 609beb4b53cda8b3d829d992f688f0ac295305cf /src | |
parent | 17804ea08ba04002990791717c0e39dd01ca4ccc (diff) | |
download | weechat-d64e852a3863ba495cb3638ebe4bf1b89983a7f3.zip |
Fixed bug with config file write (crash on FreeBSD)
Diffstat (limited to 'src')
-rw-r--r-- | src/core/wee-config-file.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c index 82f94c04c..fd352ee69 100644 --- a/src/core/wee-config-file.c +++ b/src/core/wee-config-file.c @@ -810,18 +810,19 @@ config_file_write_line (struct t_config_file *config_file, if (!config_file || !option_name) return; - va_start (argptr, value); - vsnprintf (buf, sizeof (buf) - 1, value, argptr); - va_end (argptr); - - if (!buf[0]) - string_iconv_fprintf (config_file->file, "\n[%s]\n", - option_name); - else + if (value) { + va_start (argptr, value); + vsnprintf (buf, sizeof (buf) - 1, value, argptr); + va_end (argptr); string_iconv_fprintf (config_file->file, "%s = %s\n", option_name, buf); } + else + { + string_iconv_fprintf (config_file->file, "\n[%s]\n", + option_name); + } } /* |