From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCSSM-0002XB-Jw for qemu-devel@nongnu.org; Sun, 09 Feb 2014 06:21:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WCSSG-0005CH-Jn for qemu-devel@nongnu.org; Sun, 09 Feb 2014 06:21:50 -0500 Received: from cantor2.suse.de ([195.135.220.15]:51782 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WCSSG-0005Ag-D1 for qemu-devel@nongnu.org; Sun, 09 Feb 2014 06:21:44 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 9 Feb 2014 12:21:41 +0100 Message-Id: <1391944901-23475-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] [PATCH] qtest: Unlink pid file before reading from QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi Despite 1ad3c6abc0d67e00b84abaa5527bc64b70ca2205, supplying invalid arguments to the QEMU process still leaked a /tmp/qtest-*.pid file. Fix this by reordering the reading and unlinking to before reading from QMP socket, which relies on a running process. Cc: Stefan Hajnoczi Signed-off-by: Andreas F=C3=A4rber --- tests/libqtest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index c9a4f89..9433782 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -157,14 +157,14 @@ QTestState *qtest_init(const char *extra_args) s->irq_level[i] =3D false; } =20 - /* Read the QMP greeting and then do the handshake */ - qtest_qmp_discard_response(s, ""); - qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }"); - s->qemu_pid =3D read_pid_file(pid_file); unlink(pid_file); g_free(pid_file); =20 + /* Read the QMP greeting and then do the handshake */ + qtest_qmp_discard_response(s, ""); + qtest_qmp_discard_response(s, "{ 'execute': 'qmp_capabilities' }"); + if (getenv("QTEST_STOP")) { kill(s->qemu_pid, SIGSTOP); } --=20 1.8.4.5