]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nwfilter: Move save of config until after successful assign
authorJohn Ferlan <jferlan@redhat.com>
Thu, 20 Apr 2017 15:51:22 +0000 (11:51 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 26 Apr 2017 17:13:18 +0000 (13:13 -0400)
Only save the config when using a generated UUID if we were able to
create an object for the def. There could have been "other reasons"
for the assignment to fail, so saving the config could be incorrect.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/conf/virnwfilterobj.c

index 2a060fb851165c9ade0127598565f95e8b4fc424..c69407ac80932fec6b34b9e6643b85123812605b 100644 (file)
@@ -500,14 +500,14 @@ virNWFilterObjListLoadConfig(virNWFilterObjListPtr nwfilters,
         goto error;
     }
 
+    if (!(obj = virNWFilterObjListAssignDef(nwfilters, def)))
+        goto error;
+
     /* We generated a UUID, make it permanent by saving the config to disk */
     if (!def->uuid_specified &&
         virNWFilterSaveConfig(configDir, def) < 0)
         goto error;
 
-    if (!(obj = virNWFilterObjListAssignDef(nwfilters, def)))
-        goto error;
-
     VIR_FREE(configFile);
     return obj;