From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UouAS-0001xl-Dk for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:33:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uou6R-0005ZQ-Om for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:30:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uou6R-0005YF-Dl for qemu-devel@nongnu.org; Tue, 18 Jun 2013 07:29:35 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r5IBTYiB002002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 18 Jun 2013 07:29:34 -0400 Message-ID: <51C0449B.3020502@redhat.com> Date: Tue, 18 Jun 2013 13:29:31 +0200 From: =?UTF-8?B?SsOhbiBUb21rbw==?= MIME-Version: 1.0 References: <51C02B8A.2090709@redhat.com> In-Reply-To: <51C02B8A.2090709@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 06/18/2013 11:42 AM, Paolo Bonzini wrote: > Il 03/06/2013 17:54, J=C3=A1n Tomko ha scritto: >> According to RFC 1123 [1], hostnames can start with a digit too. >> >> [1] http://tools.ietf.org/html/rfc1123#page-13 >> >> Signed-off-by: J=C3=A1n Tomko >> --- >> } else { >> - /* hostname */ >> + /* hostname or IPv4 addr */ >> if (2 !=3D sscanf(str, "%64[^:]:%32[^,]%n", host, port, &pos)= ) { >> error_setg(errp, "error parsing address '%s'", str); >> goto fail; >> } >> + if (strcspn(host, "0123456789.") =3D=3D 0) { >=20 > I think what you want here is: >=20 > if (host[strspn(host, "0123456789.")] =3D=3D '\0') { >=20 Yes, thank you for catching that. Jan > Otherwise, you're still basically testing >=20 > qemu_isdigit(str[0]) || str[0] =3D=3D '.' >=20 > Paolo >=20 >> + addr->ipv4 =3D addr->has_ipv4 =3D true; >> + } >> } >> =20 >> addr->host =3D g_strdup(host); >> >=20 >=20