if (!force) {
xs_watch(ctx->xsh, state_path, be_path);
rc = 1;
- }
+ } else {
+ xs_rm(ctx->xsh, XBT_NULL, be_path);
+ }
out:
libxl__free_all(&gc);
return rc;
char *path, *be_path, *fe_path;
unsigned int num1, num2;
char **l1 = NULL, **l2 = NULL;
- int i, j, n = 0, n_watches = 0;
- flexarray_t *toremove;
+ int i, j, n_watches = 0;
- toremove = flexarray_make(16, 1);
path = libxl__sprintf(&gc, "/local/domain/%d/device", domid);
l1 = libxl__xs_directory(&gc, XBT_NULL, path, &num1);
if (!l1) {
if (be_path != NULL) {
if (libxl__device_destroy(ctx, be_path, force) > 0)
n_watches++;
- flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
} else {
xs_rm(ctx->xsh, XBT_NULL, path);
}
if (be_path && strcmp(be_path, "")) {
if (libxl__device_destroy(ctx, be_path, force) > 0)
n_watches++;
- flexarray_set(toremove, n++, libxl__dirname(&gc, be_path));
}
if (!force) {
}
}
}
- for (i = 0; i < n; i++) {
- flexarray_get(toremove, i, (void**) &path);
- xs_rm(ctx->xsh, XBT_NULL, path);
- }
out:
- flexarray_free(toremove);
libxl__free_all(&gc);
return 0;
}
(void)wait_for_dev_destroy(ctx, &tv);
}
+ xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(&gc, dev));
rc = 0;
out: