[PATCH 02/11] virconf: Report an error in when virConfSetValue() fails

Michal Privoznik mprivozn at redhat.com
Fri Jan 14 14:39:46 UTC 2022


Callers of virConfSetValue() don't report any error, they just
pass the error blindly. Therefore, report an error when
virConfSetValue() is about to fail.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/util/virconf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/virconf.c b/src/util/virconf.c
index 07ecfc7b57..29b3622791 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1329,6 +1329,9 @@ virConfSetValue(virConf *conf,
     virConfEntry *prev = NULL;
 
     if (value && value->type == VIR_CONF_STRING && value->str == NULL) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("expecting a value for value of type %s"),
+                       virConfTypeToString(VIR_CONF_STRING));
         virConfFreeValue(value);
         return -1;
     }
-- 
2.34.1




More information about the libvir-list mailing list