From owner-freebsd-current@FreeBSD.ORG Thu Jan 20 20:55:04 2005 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D1BC16A4CE; Thu, 20 Jan 2005 20:55:04 +0000 (GMT) Received: from nagual.pp.ru (pobrecita.freebsd.ru [194.87.13.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id F0EEE43D45; Thu, 20 Jan 2005 20:55:02 +0000 (GMT) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.13.1/8.13.1) with ESMTP id j0KKt1Bg069360; Thu, 20 Jan 2005 23:55:01 +0300 (MSK) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.13.1/8.13.1/Submit) id j0KKt1jq069359; Thu, 20 Jan 2005 23:55:01 +0300 (MSK) (envelope-from ache) Date: Thu, 20 Jan 2005 23:55:01 +0300 From: Andrey Chernov To: Joerg Wunsch Message-ID: <20050120205501.GA69123@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Joerg Wunsch , current@FreeBSD.ORG, bde@FreeBSD.ORG References: <20050120192324.GA30862@uriah.heep.sax.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050120192324.GA30862@uriah.heep.sax.de> User-Agent: Mutt/1.5.6i X-AntiVirus: checked by AntiVir Milter (version: 1.1.0-3; AVE: 6.29.0.8; VDF: 6.29.0.71; host: nagual.pp.ru) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.6 (nagual.pp.ru [0.0.0.0]); Thu, 20 Jan 2005 23:55:01 +0300 (MSK) cc: current@FreeBSD.ORG cc: bde@FreeBSD.ORG Subject: Re: Implementation errors in strtol() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2005 20:55:04 -0000 On Thu, Jan 20, 2005 at 08:23:24PM +0100, Joerg Wunsch wrote: > While the standard explicitly states that empty (or whitespace-only) > input strings cause an empty subject sequence, which will in turn > cause no conversion to be performed, single signs ("+" or "-") would > contain a non-empty subject sequence, so a conversion has to take > place. FreeBSD erroneously returns EINVAL in that case. As EINVAL is Just what is eye-catching: +- can't be compared to whitespace at all. Whitespace is not subject sequence (2) but initial sequence (1) according to POSIX. Moreover, POSIX clearly allows EINVAL for strtol(): "If no conversion could be performed, 0 shall be returned and errno may be set to [EINVAL]" Reading POSIX will really help you with this issue. -- http://ache.pp.ru/