From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjUL-0006uY-8D for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUjU4-0006E4-T2 for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49303 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUjU4-0006Dd-Lf for qemu-devel@nongnu.org; Mon, 31 Mar 2014 17:11:08 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 31 Mar 2014 23:10:47 +0200 Message-Id: <1396300262-10430-2-git-send-email-afaerber@suse.de> In-Reply-To: <1396300262-10430-1-git-send-email-afaerber@suse.de> References: <1396300262-10430-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL for-2.0 01/16] Revert "qtest: Fix crash if SIGABRT during qtest_init()" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi From: Stefan Hajnoczi It turns out there are test cases that use multiple libqtest instances. We cannot use a global qtest instance in the SIGABRT handler. This reverts commit cb201b4872f16dfbce63f8648b2584631e2e965f. Signed-off-by: Stefan Hajnoczi Reviewed-by: Marcel Apfelbaum Signed-off-by: Andreas F=C3=A4rber --- tests/libqtest.c | 3 +-- tests/libqtest.h | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index b03b57a..2b90e4a 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -120,7 +120,7 @@ QTestState *qtest_init(const char *extra_args) qemu_binary =3D getenv("QTEST_QEMU_BINARY"); g_assert(qemu_binary !=3D NULL); =20 - global_qtest =3D s =3D g_malloc(sizeof(*s)); + s =3D g_malloc(sizeof(*s)); =20 socket_path =3D g_strdup_printf("/tmp/qtest-%d.sock", getpid()); qmp_socket_path =3D g_strdup_printf("/tmp/qtest-%d.qmp", getpid()); @@ -181,7 +181,6 @@ QTestState *qtest_init(const char *extra_args) void qtest_quit(QTestState *s) { sigaction(SIGABRT, &s->sigact_old, NULL); - global_qtest =3D NULL; =20 kill_qemu(s); close(s->fd); diff --git a/tests/libqtest.h b/tests/libqtest.h index 27a58fd..8268c09 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -335,7 +335,8 @@ void qtest_add_func(const char *str, void (*fn)); */ static inline QTestState *qtest_start(const char *args) { - return qtest_init(args); + global_qtest =3D qtest_init(args); + return global_qtest; } =20 /** @@ -346,6 +347,7 @@ static inline QTestState *qtest_start(const char *arg= s) static inline void qtest_end(void) { qtest_quit(global_qtest); + global_qtest =3D NULL; } =20 /** --=20 1.8.4.5