From patchwork Fri Nov 16 14:08:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 199625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 934912C0079 for ; Sat, 17 Nov 2012 01:08:47 +1100 (EST) Received: from localhost ([::1]:33382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZMb7-0001Eo-Jv for incoming@patchwork.ozlabs.org; Fri, 16 Nov 2012 09:08:45 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZMas-00013G-5p for qemu-devel@nongnu.org; Fri, 16 Nov 2012 09:08:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TZMap-0007x1-3k for qemu-devel@nongnu.org; Fri, 16 Nov 2012 09:08:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43543) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TZMao-0007ws-SW for qemu-devel@nongnu.org; Fri, 16 Nov 2012 09:08:27 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAGE8Pkn026796 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 16 Nov 2012 09:08:25 -0500 Received: from localhost (ovpn-112-43.ams2.redhat.com [10.36.112.43]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAGE8Ow9025292; Fri, 16 Nov 2012 09:08:24 -0500 From: Stefan Hajnoczi To: Date: Fri, 16 Nov 2012 15:08:14 +0100 Message-Id: <1353074895-3712-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1353074895-3712-1-git-send-email-stefanha@redhat.com> References: <1353074895-3712-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony PERARD , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 1/2] qemu-sockets: Fix parsing of the inet option 'to'. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Anthony PERARD Having a qemu command line argument like "-vnc 127.0.0.1:0,to=99" is broken. This have been break with commit 879e45c72da1569e07fbbc6a1aa2a708ea796044. Signed-off-by: Anthony PERARD Signed-off-by: Stefan Hajnoczi --- qemu-sockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu-sockets.c b/qemu-sockets.c index abcd791..03ca98d 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -551,8 +551,9 @@ static InetSocketAddress *inet_parse(const char *str, Error **errp) optstr = str + pos; h = strstr(optstr, ",to="); if (h) { - if (1 != sscanf(str, "%d%n", &to, &pos) || - (str[pos] != '\0' && str[pos] != ',')) { + h += 4; + if (sscanf(h, "%d%n", &to, &pos) != 1 || + (h[pos] != '\0' && h[pos] != ',')) { error_setg(errp, "error parsing to= argument"); goto fail; }