[PATCH v14 06/15] qemu_cgroup: Don't ignore ENOENT in qemuCgroupAllowDevicesPaths()

Michal Privoznik posted 15 patches 3 years, 6 months ago
There is a newer version of this series
[PATCH v14 06/15] qemu_cgroup: Don't ignore ENOENT in qemuCgroupAllowDevicesPaths()
Posted by Michal Privoznik 3 years, 6 months ago
There's no need to skip over ENOENT error in
qemuCgroupAllowDevicesPaths(). The path must exists when
qemuCgroupAllowDevicePath() is called because of virFileExists()
check done right above.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_cgroup.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 51702b52e1..d6f27a5a4d 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -76,16 +76,12 @@ qemuCgroupAllowDevicesPaths(virDomainObj *vm,
     size_t i;
 
     for (i = 0; deviceACL[i] != NULL; i++) {
-        int rv;
-
         if (!virFileExists(deviceACL[i])) {
             VIR_DEBUG("Ignoring non-existent device %s", deviceACL[i]);
             continue;
         }
 
-        rv = qemuCgroupAllowDevicePath(vm, deviceACL[i], perms, ignoreEacces);
-        if (rv < 0 &&
-            !virLastErrorIsSystemErrno(ENOENT))
+        if (qemuCgroupAllowDevicePath(vm, deviceACL[i], perms, ignoreEacces) < 0)
             return -1;
     }
 
-- 
2.35.1
Re: [PATCH v14 06/15] qemu_cgroup: Don't ignore ENOENT in qemuCgroupAllowDevicesPaths()
Posted by Peter Krempa 3 years, 6 months ago
On Wed, Jul 27, 2022 at 12:34:52 +0200, Michal Privoznik wrote:
> There's no need to skip over ENOENT error in
> qemuCgroupAllowDevicesPaths(). The path must exists when
> qemuCgroupAllowDevicePath() is called because of virFileExists()
> check done right above.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_cgroup.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>