mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
qemu: Call chmod() after mknod()
mknod() is affected my the current umask, so we're not guaranteed the newly-created device node will have the right permissions. Call chmod(), which is not affected by the current umask, immediately afterwards to solve the issue. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1421036
This commit is contained in:
parent
e04bd5b6fc
commit
ee6ec7824d
@ -7152,6 +7152,16 @@ qemuDomainCreateDeviceRecursive(const char *device,
|
||||
}
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Set the file permissions again: mknod() is affected by the
|
||||
* current umask, and as such might not have set them correctly */
|
||||
if (create &&
|
||||
chmod(devicePath, sb.st_mode) < 0) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to set permissions for device %s"),
|
||||
devicePath);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
if (!create) {
|
||||
|
Loading…
Reference in New Issue
Block a user