util: conf: Don't log when adding commented out lines

virConfAddEntry spams debug logs even for fully commented out lines.
Skip such messages to avoid:

2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
2017-05-12 12:35:38.867+0000: 10820: debug : virConfAddEntry:241 : Add entry (null) (nil)
...

This also fixes NULL passed to printf.
This commit is contained in:
Peter Krempa 2017-05-12 16:29:15 +02:00
parent 756ef0c353
commit 14789b7ea8
1 changed files with 4 additions and 1 deletions

View File

@ -238,7 +238,10 @@ virConfAddEntry(virConfPtr conf, char *name, virConfValuePtr value, char *comm)
if ((comm == NULL) && (name == NULL))
return NULL;
VIR_DEBUG("Add entry %s %p", name, value);
/* don't log fully commented out lines */
if (name)
VIR_DEBUG("Add entry %s %p", name, value);
if (VIR_ALLOC(ret) < 0)
return NULL;