From owner-freebsd-current@FreeBSD.ORG Tue Nov 25 18:53:19 2003 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 6922216A4CE for ; Tue, 25 Nov 2003 18:53:19 -0800 (PST) Received: from heron.mail.pas.earthlink.net (heron.mail.pas.earthlink.net [207.217.120.189]) by mx1.FreeBSD.org (Postfix) with ESMTP id A355D43FBD for ; Tue, 25 Nov 2003 18:53:18 -0800 (PST) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfn2m.dialup.mindspring.com ([165.247.220.86] helo=mindspring.com) by heron.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 1AOpnl-0004g3-00; Tue, 25 Nov 2003 18:53:14 -0800 Message-ID: <3FC40E19.6A2989B6@mindspring.com> Date: Tue, 25 Nov 2003 18:21:13 -0800 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Stefan Farfeleder References: <20031123141408.GA1426@ratsnest.hole> <20031124174457.GB27782@madman.celabo.org> <20031124182322.GB621@wombat.fafoe.narf.at> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4c74eb731a40a0bebd3726f9767c36ea1a2d4e88014a4647c350badd9bab72f9c350badd9bab72f9c cc: "boyd, rounin" cc: current@freebsd.org Subject: Re: [PATCH] libc_r bug: successful close(2) sets errno to ENOTTY 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: Wed, 26 Nov 2003 02:53:19 -0000 Stefan Farfeleder wrote: > On Mon, Nov 24, 2003 at 07:05:02PM +0100, boyd, rounin wrote: > > From: "Jacques A. Vidrine" > > > The application is broken. You must only check errno if you get an > > > error indication from the library call. > > > > errno is only meaningful after a syscall error. > > Wrong, counter-example: strtol(). Wrong; the standard specifies that the errno shall only be checked when the return value is -1. The exception in the strtol() case is only for presetting errno to 0 before you make the call, and making a check only following a -1 return. You cannot make assumptions about underlying implementations; they may be either system calls or library routines, and your application is not supposed to know or depend on which case prevails. -- Terry