Skip to contentSkip to conversation

libxenlight: two small fixes

PATCH New Stefano Stabellini 1 participant 1 message Dec 1, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxenlight: two small fixes

Hi all,
this patch contains two small fixes:

- set the domid of the guest and not the one of the stubdom in the libxl_device_model_starting returned to the user;

- check that the length of the two strings matches in libxl_name_to_domid, otherwise we can get a match for two different domains that have the same initial part of the name.

---

tools/libxl/libxl.c +1 -1
diff -r 0abcf45319ca tools/libxl/libxl.c
@@ -842,7 +842,7 @@
 
     if (starting_r) {
         *starting_r = libxl_calloc(ctx, sizeof(libxl_device_model_starting), 1);
-        (*starting_r)->domid = domid;
+        (*starting_r)->domid = info->domid;
         (*starting_r)->dom_path = libxl_xs_get_dompath(ctx, info->domid);
         (*starting_r)->for_spawn = NULL;
     }
tools/libxl/libxl_utils.c +1 -1
diff -r 0abcf45319ca tools/libxl/libxl_utils.c
@@ -68,7 +68,7 @@
     for (i = 0; i < num; i++) {
         snprintf(path, sizeof(path), "/local/domain/%s/name", l[i]);
         domname = xs_read(ctx->xsh, XBT_NULL, path, &len);
-        if (domname != NULL && !strncmp(domname, name, len)) {
+        if (domname != NULL && len == strlen(name) && !strncmp(domname, name, len)) {
             int domid_i = atoi(l[i]);
             for (j = 0; j < nb_domains; j++) {
                 if (dominfo[j].domid == domid_i) {