]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainChrSourceDefParseFile: Use virXMLProp*
authorTim Wiederhake <twiederh@redhat.com>
Wed, 21 Apr 2021 13:33:27 +0000 (15:33 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 21 Apr 2021 15:11:04 +0000 (17:11 +0200)
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/domain_conf.c

index d04c4e307490aac9408e2a3bd068606da53743ec..88d6800365b2a73c497a547c047e8b1f977909a7 100644 (file)
@@ -11695,20 +11695,11 @@ static int
 virDomainChrSourceDefParseFile(virDomainChrSourceDef *def,
                                xmlNodePtr source)
 {
-    g_autofree char *append = NULL;
-
     def->data.file.path = virXMLPropString(source, "path");
 
-    if ((append = virXMLPropString(source, "append"))) {
-        int value;
-        if ((value = virTristateSwitchTypeFromString(append)) <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("Invalid append attribute value '%s'"),
-                           append);
-            return -1;
-        }
-        def->data.file.append = value;
-    }
+    if (virXMLPropTristateSwitch(source, "append", VIR_XML_PROP_NONE,
+                                 &def->data.file.append) < 0)
+        return -1;
 
     return 0;
 }