Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Oct 2010 15:40:59 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213453 - head/lib/libc/net
Message-ID:  <201010051540.o95Fexpb061277@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Tue Oct  5 15:40:59 2010
New Revision: 213453
URL: http://svn.freebsd.org/changeset/base/213453

Log:
  When no protocol entry is found, getproto*_r(3) should
  return zero.
  
  Spotted by:	Kostik Belousov <kostikbel__at__gmail.com>
  MFC after:	2 weeks

Modified:
  head/lib/libc/net/getproto.c
  head/lib/libc/net/getprotoent.c
  head/lib/libc/net/getprotoname.c

Modified: head/lib/libc/net/getproto.c
==============================================================================
--- head/lib/libc/net/getproto.c	Tue Oct  5 15:31:56 2010	(r213452)
+++ head/lib/libc/net/getproto.c	Tue Oct  5 15:40:59 2010	(r213453)
@@ -123,7 +123,7 @@ getprotobynumber_r(int proto, struct pro
 
 	if (rv != NS_SUCCESS) {
 		errno = ret_errno;
-		return ((ret_errno != 0) ? ret_errno : -1);
+		return (ret_errno);
 	}
 	return (0);
 }

Modified: head/lib/libc/net/getprotoent.c
==============================================================================
--- head/lib/libc/net/getprotoent.c	Tue Oct  5 15:31:56 2010	(r213452)
+++ head/lib/libc/net/getprotoent.c	Tue Oct  5 15:40:59 2010	(r213453)
@@ -494,7 +494,7 @@ getprotoent_r(struct protoent *pptr, cha
 
 	if (rv != NS_SUCCESS) {
 		errno = ret_errno;
-		return ((ret_errno != 0) ? ret_errno : -1);
+		return (ret_errno);
 	}
 	return (0);
 }

Modified: head/lib/libc/net/getprotoname.c
==============================================================================
--- head/lib/libc/net/getprotoname.c	Tue Oct  5 15:31:56 2010	(r213452)
+++ head/lib/libc/net/getprotoname.c	Tue Oct  5 15:40:59 2010	(r213453)
@@ -131,7 +131,7 @@ getprotobyname_r(const char *name, struc
 
 	if (rv != NS_SUCCESS) {
 		errno = ret_errno;
-		return ((ret_errno != 0) ? ret_errno : -1);
+		return (ret_errno);
 	}
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010051540.o95Fexpb061277>