Do not even save the variable if it was set to NULL

This commit is contained in:
Pierre Pronchery 2009-02-20 23:55:04 +00:00
parent 74b506a60b
commit 5876e4663c

View File

@ -324,7 +324,7 @@ void _save_foreach_section(void const * key, void * value, void * data)
char const * var = key; char const * var = key;
char const * val = value; char const * val = value;
if(fprintf(*fp, "%s=%s\n", var, val != NULL ? val : "") >= 0) if(val == NULL || fprintf(*fp, "%s=%s\n", var, val) >= 0)
return; return;
fclose(*fp); fclose(*fp);
*fp = NULL; *fp = NULL;