priv->group = group;
if (virAsprintf(&priv->baselabel, "+%u:+%u",
- (unsigned int) user,
- (unsigned int) group) < 0)
+ (unsigned int)user,
+ (unsigned int)group) < 0)
return -1;
return 0;
return 0;
VIR_INFO("Setting DAC user and group on '%s' to '%ld:%ld'",
- NULLSTR(src ? src->path : path), (long) uid, (long) gid);
+ NULLSTR(src ? src->path : path), (long)uid, (long)gid);
if (priv && src && priv->chownCallback) {
rc = priv->chownCallback(src, uid, gid);
if (errno == EOPNOTSUPP || errno == EINVAL) {
VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not "
"supported by filesystem",
- (long) uid, (long) gid, path);
+ (long)uid, (long)gid, path);
} else if (errno == EPERM) {
VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not "
"permitted",
- (long) uid, (long) gid, path);
+ (long)uid, (long)gid, path);
} else if (errno == EROFS) {
VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not "
"possible on readonly filesystem",
- (long) uid, (long) gid, path);
+ (long)uid, (long)gid, path);
} else {
virReportSystemError(errno,
_("unable to set user and group to '%ld:%ld' "
"on '%s'"),
- (long) uid, (long) gid, path);
+ (long)uid, (long)gid, path);
return -1;
}
}
if (cbdata.secdef && !cbdata.secdef->relabel)
return 0;
- switch ((virDomainHostdevSubsysType) dev->source.subsys.type) {
+ switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
virUSBDevicePtr usb;
scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
return 0;
- switch ((virDomainHostdevSubsysType) dev->source.subsys.type) {
+ switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
virUSBDevicePtr usb;
return -1;
}
- switch ((virDomainChrType) dev_source->type) {
+ switch ((virDomainChrType)dev_source->type) {
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_FILE:
ret = virSecurityDACSetOwnership(priv, NULL,
chardevStdioLogd)
return 0;
- switch ((virDomainChrType) dev_source->type) {
+ switch ((virDomainChrType)dev_source->type) {
case VIR_DOMAIN_CHR_TYPE_DEV:
case VIR_DOMAIN_CHR_TYPE_FILE:
ret = virSecurityDACRestoreFileLabel(priv, dev_source->data.file.path);
if (seclabel && !seclabel->relabel)
return 0;
- switch ((virDomainInputType) input->type) {
+ switch ((virDomainInputType)input->type) {
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < 0)
return -1;
virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
int ret = -1;
- switch ((virDomainInputType) input->type) {
+ switch ((virDomainInputType)input->type) {
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
ret = virSecurityDACRestoreFileLabel(priv, input->source.evdev);
break;
return -1;
VIR_DEBUG("Dropping privileges to %u:%u, %d supplemental groups",
- (unsigned int) user, (unsigned int) group, ngroups);
+ (unsigned int)user, (unsigned int)group, ngroups);
if (virSetUIDGID(user, group, groups, ngroups) < 0)
return -1;
return -1;
VIR_DEBUG("Setting child to drop privileges to %u:%u",
- (unsigned int) user, (unsigned int) group);
+ (unsigned int)user, (unsigned int)group);
virCommandSetUID(cmd, user);
virCommandSetGID(cmd, group);
return rc;
}
- switch ((virDomainSeclabelType) seclabel->type) {
+ switch ((virDomainSeclabelType)seclabel->type) {
case VIR_DOMAIN_SECLABEL_STATIC:
if (seclabel->label == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
break;
case VIR_DOMAIN_SECLABEL_DYNAMIC:
if (virAsprintf(&seclabel->label, "+%u:+%u",
- (unsigned int) priv->user,
- (unsigned int) priv->group) < 0)
+ (unsigned int)priv->user,
+ (unsigned int)priv->group) < 0)
return rc;
if (seclabel->label == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR,
VIR_DEBUG("Getting DAC user and group on process '%d'", pid);
- if (virAsprintf(&path, "/proc/%d", (int) pid) < 0)
+ if (virAsprintf(&path, "/proc/%d", (int)pid) < 0)
goto cleanup;
if (lstat(path, &sb) < 0) {
}
snprintf(seclabel->label, VIR_SECURITY_LABEL_BUFLEN,
- "+%u:+%u", (unsigned int) sb.st_uid, (unsigned int) sb.st_gid);
+ "+%u:+%u", (unsigned int)sb.st_uid, (unsigned int)sb.st_gid);
ret = 0;
cleanup:
}
snprintf(seclabel->label, VIR_SECURITY_LABEL_BUFLEN,
- "+%u:+%u", (unsigned int) p.ki_uid, (unsigned int) p.ki_groups[0]);
+ "+%u:+%u", (unsigned int)p.ki_uid, (unsigned int)p.ki_groups[0]);
return 0;
}
return -1;
}
- if (strlen((char *) ctx) >= VIR_SECURITY_LABEL_BUFLEN) {
+ if (strlen((char *)ctx) >= VIR_SECURITY_LABEL_BUFLEN) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("security label exceeds "
"maximum length: %d"),
return -1;
}
- strcpy(sec->label, (char *) ctx);
+ strcpy(sec->label, (char *)ctx);
freecon(ctx);
VIR_DEBUG("label=%s", sec->label);
VIR_INFO("Setting SELinux context on '%s' to '%s'", path, tcon);
- if (setfilecon_raw(path, (VIR_SELINUX_CTX_CONST char *) tcon) < 0) {
+ if (setfilecon_raw(path, (VIR_SELINUX_CTX_CONST char *)tcon) < 0) {
int setfilecon_errno = errno;
if (getfilecon_raw(path, &econ) >= 0) {
if (seclabel == NULL)
return 0;
- switch ((virDomainInputType) input->type) {
+ switch ((virDomainInputType)input->type) {
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
if (virSecuritySELinuxSetFilecon(mgr, input->source.evdev,
seclabel->imagelabel) < 0)
if (seclabel == NULL)
return 0;
- switch ((virDomainInputType) input->type) {
+ switch ((virDomainInputType)input->type) {
case VIR_DOMAIN_INPUT_TYPE_PASSTHROUGH:
rc = virSecuritySELinuxRestoreFileLabel(mgr, input->source.evdev);
break;
scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
return 0;
- switch ((virDomainHostdevSubsysType) dev->source.subsys.type) {
+ switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
virUSBDevicePtr usb;
scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
return 0;
- switch ((virDomainHostdevSubsysType) dev->source.subsys.type) {
+ switch ((virDomainHostdevSubsysType)dev->source.subsys.type) {
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: {
virUSBDevicePtr usb;