Do not write anything when there is no value to save

This commit is contained in:
Pierre Pronchery 2009-02-19 01:31:30 +00:00
parent 992c5cbd59
commit 74b506a60b

View File

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