Hi,

>>>>> On Sun, 3 Oct 2010 21:49:26 +0300
>>>>> Kostik Belousov <kostik...@gmail.com> said:

kostikbel> I suspect there is some subtle issue with the commit present.
kostikbel> When getprotobyname_r() is unable to find the protocol, it seems
kostikbel> that established behaviour is to return 0 and set *protoent to NULL.

The behavior you mentioned is questionable to me.  Though I cannot
find the manpage of getprotobyname_r(3), there is following
description in the manpage of gethostbyname_r(3) on CentOS:

        Glibc2 also has reentrant versions gethostbyname_r() and
        gethostbyname2_r().  These return 0 on success and non-zero on
        error.

When getprotobyname_r(3) is unable to find the protocol, it should be
treated as error, IMHO.  My intention is that when getprotobyname_r(3)
ends up with error but errno is zero, the return code should be
non-zero (-1).

kostikbel> The getprotobyname_r() in HEAD and stable/8, when the protocol
kostikbel> cannot be found, return whatever value was present in errno at the 
time
kostikbel> of the call.

In anyway, errno should be cleared.  I've just committed to clear
errno for each method dispatch.

kostikbel> When run with the argument "tcp1" on Linux, I get
kostikbel>      Res 0 errno 0 Success pres (nil)
kostikbel> On the recent FreeBSD I get
kostikbel>      Res 25 errno 25 Inappropriate ioctl for device pres 0x0
kostikbel> (ENOTTY is from stdio).

Now, it shows:

        Res -1 errno 22 Unknown error: 0 pres 0x0

(When strerror(3) is called with 0 for its argument, it set errno to
EINVAL.)

Sincerely,

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
u...@mahoroba.org  u...@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to