Skip to contentSkip to conversation

libxl: return an error if connection to xenstore fails

PATCH New Ian Campbell 1 participant 1 message Dec 2, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: return an error if connection to xenstore fails

# HG changeset patch
# User Ian Campbell <[email protected]> # Date 1291293181 0
# Node ID 41f894c00dc1c969889a5974be8d05361ac5cec2 # Parent 658a68a831c3c336af505f456b475a9936490b91
libxl: return an error if connection to xenstore fails

tools/libxl/libxl_device.c +6 -0
diff -r 658a68a831c3 -r 41f894c00dc1 tools/libxl/libxl_device.c
@@ -429,6 +429,11 @@ int libxl__wait_for_device_model(libxl_c
     char **l = NULL;
 
     xsh = xs_daemon_open();
+    if (xsh == NULL) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to open xenstore connection");
+        goto err;
+    }
+
     path = libxl__sprintf(&gc, "/local/domain/0/device-model/%d/state", domid);
     xs_watch(xsh, path, path);
     tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
@@ -469,6 +474,7 @@ again:
     xs_unwatch(xsh, path, path);
     xs_daemon_close(xsh);
     LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
+err:
     libxl__free_all(&gc);
     return -1;
 }