From owner-freebsd-current@FreeBSD.ORG Sat Jan 22 17:50:05 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 5D80416A4CE for ; Sat, 22 Jan 2005 17:50:05 +0000 (GMT) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 916DA43D1F for ; Sat, 22 Jan 2005 17:50:04 +0000 (GMT) (envelope-from j@uriah.heep.sax.de) Received: from sax.sax.de (localhost [127.0.0.1]) by sax.sax.de (8.12.10/8.12.10) with ESMTP id j0MHo3Yu086662; Sat, 22 Jan 2005 18:50:03 +0100 (CET) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.12.10/8.12.10/Submit) with UUCP id j0MHo3Qq086661; Sat, 22 Jan 2005 18:50:03 +0100 (CET) (envelope-from j@uriah.heep.sax.de) Received: from uriah.heep.sax.de (localhost [127.0.0.1]) by uriah.heep.sax.de (8.13.1/8.13.1) with ESMTP id j0MHlXO2035067; Sat, 22 Jan 2005 18:47:33 +0100 (MET) (envelope-from j@uriah.heep.sax.de) Received: (from j@localhost) by uriah.heep.sax.de (8.13.1/8.13.1/Submit) id j0MHlX69035066; Sat, 22 Jan 2005 18:47:33 +0100 (MET) (envelope-from j) Date: Sat, 22 Jan 2005 18:47:33 +0100 From: Joerg Wunsch To: current@freebsd.org Message-ID: <20050122174733.GZ30862@uriah.heep.sax.de> References: <20050121221156.GA21459@nagual.pp.ru> <20050120192324.GA30862@uriah.heep.sax.de> <20050120205501.GA69123@nagual.pp.ru> <20050120211449.GC30862@uriah.heep.sax.de> <20050120214406.GA70088@nagual.pp.ru> <20050120222137.GE30862@uriah.heep.sax.de> <20050121230949.GA34313@VARK.MIT.EDU> <20050122113015.GV30862@uriah.heep.sax.de> <20050122171743.GB39943@nagual.pp.ru> <20050122173526.GD39943@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050122173526.GD39943@nagual.pp.ru> User-Agent: Mutt/1.4.2.1i X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-GPG-Fingerprint: 5E84 F980 C3CA FD4B B584 1070 F48C A81B 69A8 5873 X-Spam-Status: No, score=-2.6 required=7.5 tests=AWL,BAYES_00 autolearn=ham version=3.0.1 X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on uriah.heep.sax.de cc: Andrey Chernov Subject: Re: Implementation errors in strtol() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Joerg Wunsch List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2005 17:50:05 -0000 As Andrey Chernov wrote: > > even after checking that endptr moved can't check just > I mean that another case still possible where errno check placed > _before_ endptr checking, to detect, say, wrong user-entered "base" > by EINVAL. It can't be detected by portable application in 100% > cases, because EINVAL can be returned in other cases too. But you'll probably agree that in 99.99 % of all cases, strtol() is used using a fixed, developer-given value for base. ;-) Btw., first checking for a valid conversion (using endptr), and then checking errno would still work fine in that case, as after the conversion was identified to be valid, the only source for errno == EINVAL remaining is a wrong value for `base'. So there's still no need to explicitly consider EINVAL in any other context... But I guess we are really starting to bore anyone else, so if you still disagree with the above, let's take that privately, poshalujsta. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)