[lib] Fix error handling in tabula_rasa().
authorMaximilian Wilhelm <max@rfc2324.org>
Tue, 3 Nov 2009 15:34:48 +0000 (16:34 +0100)
committerMaximilian Wilhelm <max@rfc2324.org>
Tue, 3 Nov 2009 15:34:48 +0000 (16:34 +0100)
Signed-off-by: Maximilian Wilhelm <max@rfc2324.org>

lib/core.c

index 7615985..3b96a81 100644 (file)
@@ -390,7 +390,12 @@ vsc_mgmt_tabula_rasa (struct VscError *error,
                                                            MAX_DOMAIN_IDS);
                        if (doms_found < 0) {
                                _ERROR_FROM_LIBVIRT (local_error, NULL);
-                               break;
+
+                               error->occured = 1;
+                               vsc_error_append_branch (error, local_error);
+                               local_error = vsc_error_new ();
+
+                               goto kill_defined_domains;
                        }
 
                        for (dom_id = 0; dom_id < doms_found; dom_id++) {
@@ -433,12 +438,18 @@ vsc_mgmt_tabula_rasa (struct VscError *error,
                 *            all / most of them. As MAX_DOMAIN_IDS is resonable
                 *            large, this _should_ not happen in practice.
                 */
+kill_defined_domains:
                do {
                        doms_found = virConnectListDefinedDomains (conn,
                                                                   domain_names,
                                                                   MAX_DOMAIN_IDS);
                        if (doms_found < 0) {
                                _ERROR_FROM_LIBVIRT (local_error, NULL);
+
+                               error->occured = 1;
+                               vsc_error_append_branch (error, local_error);
+                               local_error = vsc_error_new ();
+
                                break;
                        }