[PATCH] test: qemu: Fix error message when populating fd groups

Peter Krempa via Devel posted 1 patch 3 days, 1 hour ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/152b07e766161a0daa32f7a9f6afb8c30f4684eb.1778573011.git.pkrempa@redhat.com
tests/testutilsqemu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] test: qemu: Fix error message when populating fd groups
Posted by Peter Krempa via Devel 3 days, 1 hour ago
From: Peter Krempa <pkrempa@redhat.com>

The 'new->fds' array is not yet initialized at the point where the check
if the FD is occupied happens so the error would always report that FD
'0' is in use. Use 'new->testfds' instead.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 tests/testutilsqemu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index e9bdbdbbe7..e7a61d0c6f 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -727,7 +727,7 @@ testQemuInfoSetArgs(testQemuInfo *info,
                 new->testfds[i] = va_arg(argptr, unsigned int);

                 if (fcntl(new->testfds[i], F_GETFD) != -1) {
-                    fprintf(stderr, "fd '%d' is already in use\n", new->fds[i]);
+                    fprintf(stderr, "fd '%d' is already in use\n", new->testfds[i]);
                     abort();
                 }

-- 
2.54.0
Re: [PATCH] test: qemu: Fix error message when populating fd groups
Posted by Pavel Hrdina via Devel 3 days ago
On Tue, May 12, 2026 at 10:03:31AM +0200, Peter Krempa via Devel wrote:
> From: Peter Krempa <pkrempa@redhat.com>
> 
> The 'new->fds' array is not yet initialized at the point where the check
> if the FD is occupied happens so the error would always report that FD
> '0' is in use. Use 'new->testfds' instead.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  tests/testutilsqemu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>