From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
This fixes an error path when virCgroupV2DevicesDetectProg() fails but
wasn't needed in the first place on VM shutdown.
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
src/util/vircgroupv2devices.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c
index d62ee12a05..997ef82964 100644
--- a/src/util/vircgroupv2devices.c
+++ b/src/util/vircgroupv2devices.c
@@ -541,12 +541,13 @@ virCgroupV2DevicesPrepareProg(virCgroupPtr group)
int
virCgroupV2DevicesRemoveProg(virCgroupPtr group)
{
- if (virCgroupV2DevicesDetectProg(group) < 0)
- return -1;
-
if (group->unified.devices.progfd <= 0 &&
group->unified.devices.mapfd <= 0)
return 0;
+ if (virCgroupV2DevicesDetectProg(group) < 0) {
+ return -1;
+ }
+
if (group->unified.devices.mapfd >= 0)
VIR_FORCE_CLOSE(group->unified.devices.mapfd);
--
2.26.0.rc2.42.g98cedd0233