Date: Sun, 3 Oct 2010 21:49:26 +0300 From: Kostik Belousov <kostikbel@gmail.com> To: Hajimu UMEMOTO <ume@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211276 - head/lib/libc/net Message-ID: <20101003184925.GA87647@deviant.kiev.zoral.com.ua> In-Reply-To: <201008130639.o7D6dsk1022779@svn.freebsd.org> References: <201008130639.o7D6dsk1022779@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--uAKRQypu60I7Lcqm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 13, 2010 at 06:39:54AM +0000, Hajimu UMEMOTO wrote: > Author: ume > Date: Fri Aug 13 06:39:54 2010 > New Revision: 211276 > URL: http://svn.freebsd.org/changeset/base/211276 >=20 > Log: > - When there is no room for returning the result, nss backend > have to return ERANGE and terminate with NS_RETURN. > - When gethostbyname_r(3) and the friends end with an error, > set errno to the value nss backend returns, and return errno > value. > =20 > PR: kern/131623 > MFC after: 2 weeks I suspect there is some subtle issue with the commit present. When getprotobyname_r() is unable to find the protocol, it seems that established behaviour is to return 0 and set *protoent to NULL. The getprotobyname_r() in HEAD and stable/8, when the protocol cannot be found, return whatever value was present in errno at the time of the call. Below is the example: #include <errno.h> #include <netdb.h> #include <stdio.h> #include <strings.h> int main(int argc, char *argv[]) { char buf[1024]; struct protoent proto, *pres; int res; res =3D getprotobyname_r(argv[1], &proto, buf, sizeof(buf), &pres); if (res =3D=3D 0 && pres !=3D NULL) printf("Protocol %s num %d (%p %p)\n", proto.p_name, proto.p_proto, &proto, pres); else printf("Res %d errno %d %s pres %p\n", res, errno, strerror(errno), pres); return (0); } When run with the argument "tcp1" on Linux, I get Res 0 errno 0 Success pres (nil) On the recent FreeBSD I get Res 25 errno 25 Inappropriate ioctl for device pres 0x0 (ENOTTY is from stdio). --uAKRQypu60I7Lcqm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyo0DUACgkQC3+MBN1Mb4gmeACfa0YqIp8SFgMncR4Tn/DST+JX j8sAoMvKs6MbJxDmuboidMUZxRzhGeJp =B8Dr -----END PGP SIGNATURE----- --uAKRQypu60I7Lcqm--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101003184925.GA87647>