From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1acxbv-0008Q7-SB for qemu-devel@nongnu.org; Mon, 07 Mar 2016 11:02:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1acxbv-0001rj-0h for qemu-devel@nongnu.org; Mon, 07 Mar 2016 11:02:19 -0500 References: <1455615450-15138-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1455615450-15138-3-git-send-email-xiecl.fnst@cn.fujitsu.com> <56DB21B7.7050104@redhat.com> From: Eric Blake Message-ID: <56DDA5FF.2050900@redhat.com> Date: Mon, 7 Mar 2016 09:02:07 -0700 MIME-Version: 1.0 In-Reply-To: <56DB21B7.7050104@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Mbmx1LqJbLbQWUtDae6agINrsvtvJr5GH" Subject: Re: [Qemu-devel] [PATCH v10 2/3] quorum: implement bdrv_add_child() and bdrv_del_child() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , Changlong Xie , qemu devel , Alberto Garcia , Kevin Wolf , Stefan Hajnoczi Cc: qemu block , Jiang Yunhong , Dong Eddie , Markus Armbruster , "Dr. David Alan Gilbert" , Gonglei , zhanghailiang This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Mbmx1LqJbLbQWUtDae6agINrsvtvJr5GH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/05/2016 11:13 AM, Max Reitz wrote: >> + index =3D atoi(child->name + 9); >=20 > Optional: Assert absence of an error: >=20 Indeed, atoi() is worthless, because it cannot do error detection. > unsigned long index; > char *endptr; >=20 > index =3D strtoul(child->name + 9, &endptr, 10); > assert(index >=3D 0 && !*endptr); Still incorrect; you aren't handling errno properly for detecting all errors. Even better is to use qemu_strtoul(), which already handles proper error detection. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Mbmx1LqJbLbQWUtDae6agINrsvtvJr5GH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJW3aX/AAoJEKeha0olJ0Nq4Y0H/1U4EW+v4F14GEBQYljyaltz MOy0XBNxFSksW5ToGeFCNIfa4z3HPw1B1jFmxpgqf2myjS/hECgjit6cerOkhLBO l1hpy4pXfQhGj0wBa3o6MOIFi2SyNsdFlTeG1X7XqStYSdtMP/4QZF+YOxxllJUG 13Z8/mGnXV8fZQUFeeSvsl8+8JaUwkXcsI6FvnkajEhN17NPe4s1/tvrBkQZN7ye LkQmwdRpYtxQCmChAg4ruq0pzEgvVgpvLiNjOYaylYYu5v5WZZJkUmx3UJM+rnQP ZonDbiOlLnB8SrofrfyCOuhdQ6rKYZtdFp11Uxo4I4LpEqKFmGfs0UhAVvOinlo= =ZEDa -----END PGP SIGNATURE----- --Mbmx1LqJbLbQWUtDae6agINrsvtvJr5GH--