mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
selinux: Don't fail RestoreAll if file doesn't have a default label
When restoring selinux labels after a VM is stopped, any non-standard path that doesn't have a default selinux label causes the process to stop and exit early. This isn't really an error condition IMO. Of course the selinux API could be erroring for some other reason but hopefully that's rare enough to not need explicit handling. Common example here is storing disk images in a non-standard location like under /mnt.
This commit is contained in:
parent
add633bdf9
commit
767be8be72
@ -936,7 +936,11 @@ virSecuritySELinuxRestoreSecurityFileLabel(const char *path)
|
||||
}
|
||||
|
||||
if (getContext(newpath, buf.st_mode, &fcon) < 0) {
|
||||
/* Any user created path likely does not have a default label,
|
||||
* which makes this an expected non error
|
||||
*/
|
||||
VIR_WARN("cannot lookup default selinux label for %s", newpath);
|
||||
rc = 0;
|
||||
} else {
|
||||
rc = virSecuritySELinuxSetFilecon(newpath, fcon);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user