An error on one domain doesn't apply to others.  Continue the loop over
all domains if init_domain() fails.

There is a mix of positive and negative errors.  0 is success, so just
check for that.

The last rc value is used as the exit value, so clear it before the end.
This avoids a stale rc value indicating failure.

Signed-off-by: Jason Andryuk <jason.andr...@amd.com>
---
v3:
Use != 0 since there are both positive and negative errors
---
 tools/helpers/init-dom0less.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c
index d08b0b1362..ce70ddee29 100644
--- a/tools/helpers/init-dom0less.c
+++ b/tools/helpers/init-dom0less.c
@@ -406,12 +406,14 @@ int main(int argc, char **argv)
             rc = init_domain(&info[i]);
             if (rc) {
                 fprintf(stderr, "init_domain failed.\n");
-                goto out;
             }
         } else {
             printf("Domain %u has already been initialized\n", domid);
         }
     }
+
+    rc = 0;
+
 out:
     libxl_dominfo_list_free(info, nb_vm);
     return rc;
-- 
2.50.1


Reply via email to