Skip to contentSkip to conversation

xl: Check dom0 on command level when destroy domains

PATCH New Yang Hongyang 1 participant 1 message May 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: Check dom0 on command level when destroy domains

Check dom0 on command level when destroy domains.

tools/libxl/xl_cmdimpl.c +4 -0
diff -r 0a0bdb02600b tools/libxl/xl_cmdimpl.c
@@ -1568,6 +1568,10 @@
 {
     int rc;
     find_domain(p);
+    if (domid == 0) {
+        fprintf(stderr, "Cannot destroy privileged domain 0.\n\n");
+        exit(-1);
+    }
     rc = libxl_domain_destroy(&ctx, domid, 0);
     if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); }
 }
Signature · 2 lines
Regards
Yang Hongyang