From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr5Md-00037N-FW for qemu-devel@nongnu.org; Thu, 12 Dec 2013 07:27:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vr5MW-0000n0-W7 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 07:27:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr5MW-0000m9-Oj for qemu-devel@nongnu.org; Thu, 12 Dec 2013 07:27:28 -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 rBCCRRle017514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Dec 2013 07:27:27 -0500 Message-ID: <1386851244.19301.46.camel@nilsson.home.kraxel.org> From: Gerd Hoffmann Date: Thu, 12 Dec 2013 13:27:24 +0100 In-Reply-To: <52A8EF33.4020207@redhat.com> References: <1386763230-9202-1-git-send-email-kraxel@redhat.com> <52A8EF33.4020207@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] inet_listen_opts: add error checking List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org Hi, > > + if (port_offset) { > > + int baseport; > > + errno = 0; > > + baseport = strtol(port, NULL, 10); > > WHY is strtol() such a PAINFUL interface to use correctly? Crossed my mind too after reading the manpage, which sayed you should clear errno to reliable detect errors as checking the return value doesn't cut it. Your points obviously underline that. > And WHY > can't qemu copy libvirt's lead of writing a SANE wrapper function, and > then mandating that the rest of the code base use the sane wrapper > instead of strtol()? > Care to share a pointer to the code? thanks, Gerd