From patchwork Thu Nov 8 15:11:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 197849 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 698B02C0147 for ; Fri, 9 Nov 2012 02:12:43 +1100 (EST) Received: from localhost ([::1]:37879 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWTmb-0003YR-ET for incoming@patchwork.ozlabs.org; Thu, 08 Nov 2012 10:12:41 -0500 Received: from eggs.gnu.org ([208.118.235.92]:53083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWTmP-0003Xa-QF for qemu-devel@nongnu.org; Thu, 08 Nov 2012 10:12:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TWTmG-0001QQ-C7 for qemu-devel@nongnu.org; Thu, 08 Nov 2012 10:12:29 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:26058) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TWTmG-0001QJ-7a for qemu-devel@nongnu.org; Thu, 08 Nov 2012 10:12:20 -0500 X-IronPort-AV: E=Sophos;i="4.80,738,1344211200"; d="scan'208";a="213888376" Received: from ftlpmailmx02.citrite.net ([10.13.107.66]) by FTLPIPO02.CITRIX.COM with ESMTP/TLS/RC4-MD5; 08 Nov 2012 15:11:53 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.66) with Microsoft SMTP Server id 8.3.279.1; Thu, 8 Nov 2012 10:11:52 -0500 Received: from [10.80.3.61] (helo=perard.uk.xensource.com) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1TWTlo-0006jc-8G; Thu, 08 Nov 2012 15:11:52 +0000 From: Anthony PERARD To: QEMU-devel Date: Thu, 8 Nov 2012 15:11:41 +0000 Message-ID: <1352387501-21907-1-git-send-email-anthony.perard@citrix.com> X-Mailer: git-send-email 1.8.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.63 Cc: Anthony PERARD , Paolo Bonzini , Luiz Capitulino Subject: [Qemu-devel] [PATCH] 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 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 Tested-by: Lei Li Reviewed-by: Paolo Bonzini --- qemu-sockets.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qemu-sockets.c b/qemu-sockets.c index abcd791..11d3d32 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 (1 != sscanf(h, "%d%n", &to, &pos) || + (h[pos] != '\0' && h[pos] != ',')) { error_setg(errp, "error parsing to= argument"); goto fail; }