From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 4 13:35:10 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 040B337B401 for ; Fri, 4 Jul 2003 13:35:10 -0700 (PDT) Received: from tomts20-srv.bellnexxia.net (tomts20-srv.bellnexxia.net [209.226.175.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C60244011 for ; Fri, 4 Jul 2003 13:35:09 -0700 (PDT) (envelope-from matt@compar.com) Received: from hermes ([65.95.177.176]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with SMTP id <20030704203507.UGUB3723.tomts20-srv.bellnexxia.net@hermes>; Fri, 4 Jul 2003 16:35:07 -0400 Message-ID: <002601c3426b$9d3a3f80$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: "John-Mark Gurney" References: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> <20030704185032.GB605@funkthat.com> Date: Fri, 4 Jul 2003 16:34:06 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 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 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 20:35:10 -0000 ----- Original Message ----- From: "John-Mark Gurney" To: "Matthew Emmerton" Cc: Sent: Friday, July 04, 2003 2:50 PM Subject: Re: RFC: Change to sys_errlist > 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. You're right. Furthermore, SUSv3 indicates that errno is a positive integer; this presumably excludes 0 so our existing implementation is fine. I guess I'll have to bring this up with the Linux folks and see if they'll change. -- Matt Emmerton