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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
---
 src/util/virconf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/util/virconf.c b/src/util/virconf.c
index 9840ca6c7..4498d253a 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -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;

-- 
2.12.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux