[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/2]xl: Check invalid domid in find_domain()



If domain id is invalid, find_domain should return error because
the specified domain does not exist.

Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>

diff -r a49dfaa986b0 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri May 14 01:27:26 2010 +0800
+++ b/tools/libxl/xl_cmdimpl.c  Fri May 14 01:29:36 2010 +0800
@@ -137,7 +137,11 @@
         fprintf(stderr, "%s is an invalid domain identifier (rc=%d)\n", p, rc);
         exit(2);
     }
-    common_domname = was_name ? p : 0;
+    common_domname = was_name ? p : libxl_domid_to_name(&ctx, domid);
+    if (!common_domname) {
+        fprintf(stderr, "%s is an invalid domain identifier.\n", p);
+        exit(2);
+    }
 }
 
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)

-- 
Regards
Yang Hongyang

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.