From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 4 11:50:21 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 79C1637B401 for ; Fri, 4 Jul 2003 11:50:21 -0700 (PDT) Received: from mail.cyberonic.com (mail.cyberonic.com [4.17.179.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 498A943FB1 for ; Fri, 4 Jul 2003 11:50:20 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (node-40244c0a.sfo.onnet.us.uu.net [64.36.76.10]) by mail.cyberonic.com (8.12.8/8.12.5) with ESMTP id h64IsNMu030002; Fri, 4 Jul 2003 14:54:24 -0400 Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.9/8.11.6) id h64IoWOk015046; Fri, 4 Jul 2003 11:50:32 -0700 (PDT) (envelope-from jmg) Date: Fri, 4 Jul 2003 11:50:32 -0700 From: John-Mark Gurney To: Matthew Emmerton Message-ID: <20030704185032.GB605@funkthat.com> Mail-Followup-To: Matthew Emmerton , freebsd-hackers@freebsd.org References: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: freebsd-hackers@freebsd.org Subject: Re: RFC: Change to sys_errlist X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Jul 2003 18:50:21 -0000 Matthew Emmerton wrote this message on Fri, Jul 04, 2003 at 14:03 -0400: > This is a RFC on a change to sys_errlist for errno = 0. > > On Linux, if perror() or strerror() is called with errno = 0, the resulting > string is "Success". > On FreeBSD, the resulting string is "Unknown error: 0". > > I think that FreeBSD's output is unintentionally confusing, as errno = 0 > implies success. > > The following patch will change the output to the Linux behaviour. > > I appreciate any comments. This is not good. This will just encourge more programers to not properly test return values. Read man 2 errno says: "Successful calls never set errno;", so this depends upon the programmer initalizing errno to 0 before they make their call. If they are already so poor as to be calling perror, etc with errno 0, then I doubt that we can depend upon them initalizing errno to 0 and giving consistant results. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."