Date: Fri, 4 Jul 2003 11:50:32 -0700 From: John-Mark Gurney <gurney_j@efn.org> To: Matthew Emmerton <matt@gsicomp.on.ca> Cc: freebsd-hackers@freebsd.org Subject: Re: RFC: Change to sys_errlist Message-ID: <20030704185032.GB605@funkthat.com> In-Reply-To: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> References: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
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."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030704185032.GB605>
