Fixed bug with config file write (crash on FreeBSD)

This commit is contained in:
Sebastien Helleu 2008-03-02 14:50:44 +01:00
parent 17804ea08b
commit d64e852a38

View File

@ -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);
}
}
/*