From fccb7c2ccec7fe9a831be04e589b5fb56a048828 Mon Sep 17 00:00:00 2001 From: xuyinghao Date: Tue, 9 Aug 2022 18:58:05 +0800 Subject: [PATCH 13/22] qemu_cgroup: Drop ENOENT special case for RNG devices Description: When allowing or denying RNG device in CGroups there's a special check if the backend device exists (errno == ENOENT) in which case success is returned to caller. This is in contrast with the rest of the functions and in fact wrong too - if the backend device doesn't exist then QEMU will fail opening it. Might as well signal error here. Signed-off-by: Michal Privoznik Reviewed-by: Pavel Hrdina --- src/qemu/qemu_cgroup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index aa721df100..c30ede7394 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -667,9 +667,9 @@ qemuSetupRNGCgroup(virDomainObjPtr vm, virDomainAuditCgroupPath(vm, priv->cgroup, "allow", rng->source.file, "rw", rv); - if (rv < 0 && - !virLastErrorIsSystemErrno(ENOENT)) + if (rv < 0) { return -1; + } } return 0; @@ -694,9 +694,9 @@ qemuTeardownRNGCgroup(virDomainObjPtr vm, virDomainAuditCgroupPath(vm, priv->cgroup, "deny", rng->source.file, "rw", rv); - if (rv < 0 && - !virLastErrorIsSystemErrno(ENOENT)) + if (rv < 0) { return -1; + } } return 0; -- 2.33.0