@@ -1606,7 +1606,6 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
libxl_ctx *ctx = CTX;
uint32_t domid = dis->domid;
char *dom_path;
- char *pid;
int rc, dm_present;
libxl__ev_child_init(&dis->destroyer);
@@ -1642,8 +1641,7 @@ void libxl__destroy_domid(libxl__egc *egc, libxl__destroy_domid_state *dis)
}
/* fall through */
case LIBXL_DOMAIN_TYPE_PV:
- pid = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("/local/domain/%d/image/device-model-pid", domid));
- dm_present = (pid != NULL);
+ dm_present = 1;
break;
case LIBXL_DOMAIN_TYPE_INVALID:
rc = ERROR_FAIL;
@@ -2053,11 +2053,16 @@ static int kill_device_model(libxl__gc *gc, const char *xs_path_pid)
int ret, pid;
ret = libxl__xs_read_checked(gc, XBT_NULL, xs_path_pid, &xs_pid);
- if (ret || !xs_pid) {
+ if (ret) {
LOG(ERROR, "unable to find device model pid in %s", xs_path_pid);
ret = ret ? : ERROR_FAIL;
goto out;
}
+ if (!xs_pid) {
+ /* Jolly good */
+ ret = 0;
+ goto out;
+ }
pid = atoi(xs_pid);
ret = kill(pid, SIGHUP);
If the pid is absent in xenstore, this means there is no such DM. Do not complain about this, then. This allows us to simplify call sites. Do so for libxl__destroy_domid. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> --- v6: New patch. --- tools/libxl/libxl.c | 4 +--- tools/libxl/libxl_dm.c | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-)