namepath = s;
strcat(namepath, "/name");
data = xs_read(xs, XBT_NULL, namepath, &len);
+ free(namepath);
if (!data)
return -1;
if (!len) {
}
free(type);
- if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port))
- goto out;
-
if (ring_ref != dom->ring_ref) {
if (dom->interface != NULL)
munmap(dom->interface, getpagesize());
dom->ring_ref = ring_ref;
}
+ /* Go no further if port has not changed and we are still bound. */
+ if (remote_port == dom->remote_port) {
+ xc_evtchn_status_t status = {
+ .dom = DOMID_SELF,
+ .port = dom->local_port };
+ if ((xc_evtchn_status(xc, &status) == 0) &&
+ (status.status == EVTCHNSTAT_interdomain))
+ goto out;
+ }
+
dom->local_port = -1;
dom->remote_port = -1;
if (dom->xce_handle != -1)
}
}
- if (log_guest)
+ if (log_guest && (dom->log_fd == -1))
dom->log_fd = create_domain_log(dom);
out: