static int virSecurityStackClearSocketLabel(virSecurityManagerPtr mgr, virDomainObjPtr vm) { virSecurityStackDataPtr priv = virSecurityManagerGetPrivateData(mgr); int rc = 0; if (virSecurityManagerClearSocketLabel(priv->secondary, vm) < 0) rc = -1; if (virSecurityManagerClearSocketLabel(priv->primary, vm) < 0) rc = -1; return rc; }
static virLXCMonitorPtr virLXCProcessConnectMonitor(virLXCDriverPtr driver, virDomainObjPtr vm) { virLXCMonitorPtr monitor = NULL; virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver); if (virSecurityManagerSetSocketLabel(driver->securityManager, vm->def) < 0) goto cleanup; /* Hold an extra reference because we can't allow 'vm' to be * deleted while the monitor is active */ virObjectRef(vm); monitor = virLXCMonitorNew(vm, cfg->stateDir, &monitorCallbacks); if (monitor == NULL) virObjectUnref(vm); if (virSecurityManagerClearSocketLabel(driver->securityManager, vm->def) < 0) { if (monitor) { virObjectUnref(monitor); monitor = NULL; } goto cleanup; } cleanup: virObjectUnref(cfg); return monitor; }