From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fk3cL-0003P4-JE for qemu-devel@nongnu.org; Mon, 30 Jul 2018 04:33:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fk3cI-0004Xj-Ba for qemu-devel@nongnu.org; Mon, 30 Jul 2018 04:33:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45082 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fk3cI-0004Wk-5B for qemu-devel@nongnu.org; Mon, 30 Jul 2018 04:33:22 -0400 From: Markus Armbruster Date: Mon, 30 Jul 2018 10:33:10 +0200 Message-Id: <20180730083317.11765-17-armbru@redhat.com> In-Reply-To: <20180730083317.11765-1-armbru@redhat.com> References: <20180730083317.11765-1-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v3 16/23] migration-test: Make wait_command() cope with '%' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: thuth@redhat.com, f4bug@amsat.org, eblake@redhat.com, Juan Quintela , "Dr . David Alan Gilbert" wait_command() passes its argument @command to qtest_qmp_send(). Falls apart if @command contain '%'. Two ways to disarm this trap: suppress interpretation of '%' by passing @command as argument to format string "%s", or fix it by having wait_command() take the variable arguments to go with @command. Do the latter. This is another step towards compile-time format string checking without triggering -Wformat-nonliteral. Cc: Juan Quintela Cc: Dr. David Alan Gilbert Signed-off-by: Markus Armbruster Reviewed-by: Juan Quintela Reviewed-by: Eric Blake --- tests/migration-test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/migration-test.c b/tests/migration-test.c index 860b8aa0b9..0c92f2b1cd 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -156,9 +156,14 @@ static void stop_cb(void *opaque, const char *name, QDict *data) /* * Events can get in the way of responses we are actually waiting for. */ -static QDict *wait_command(QTestState *who, const char *command) +static QDict *wait_command(QTestState *who, const char *command, ...) { - qtest_qmp_send(who, command); + va_list ap; + + va_start(ap, command); + qtest_qmp_vsend(who, command, ap); + va_end(ap); + return qtest_qmp_receive_success(who, stop_cb, NULL); } -- 2.17.1