qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/2] tests/qtest: fix registration of ABRT handler for QEM


From: Thomas Huth
Subject: Re: [PATCH v2 1/2] tests/qtest: fix registration of ABRT handler for QEMU cleanup
Date: Fri, 13 May 2022 18:08:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

On 13/05/2022 17.49, Daniel P. Berrangé wrote:
qtest_init registers a hook to cleanup the running QEMU process
should g_assert() fire before qtest_quit is called. When the first
hook is registered, it is supposed to triggere registration of the
SIGABRT handler. Unfortunately the logic in hook_list_is_empty is
inverted, so the SIGABRT handler never gets registered, unless
2 or more QEMU processes are run concurrently. This caused qtest
to leak QEMU processes anytime g_assert triggers.

Ouch, thanks for spotting it!

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
  tests/qtest/libqtest.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c
index 228357f1ea..4a4697c0d1 100644
--- a/tests/qtest/libqtest.c
+++ b/tests/qtest/libqtest.c
@@ -197,11 +197,11 @@ static bool hook_list_is_empty(GHookList *hook_list)
      GHook *hook = g_hook_first_valid(hook_list, TRUE);
if (!hook) {
-        return false;
+        return true;
      }
g_hook_unref(hook_list, hook);
-    return true;
+    return false;
  }

Reviewed-by: Thomas Huth <thuth@redhat.com>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]