This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in getent program


There is a small bug in the getent program distributed with glibc.
Right now

   $ getent services 25/tcp

doesn't give you anything, while

   $ getent services 6400/tcp

(that's 25 in network byte order) gives you something like

   smtp          25/tcp

Here's a fix.

Mark


2000-07-12  Mark Kettenis  <kettenis@gnu.org>

	* nss/getent.c (services_keys): Pass port number in network byte
	order in call to getservbyport.


Index: nss/getent.c
===================================================================
RCS file: /cvs/glibc/libc/nss/getent.c,v
retrieving revision 1.3
diff -u -p -r1.3 getent.c
--- nss/getent.c	2000/01/12 10:27:23	1.3
+++ nss/getent.c	2000/07/12 06:37:58
@@ -366,7 +366,7 @@ services_keys (int number, char *key[])
 	  *proto++ = '\0';
 
 	  if (isdigit (key[i][0]))
-	    serv = getservbyport (atol (key[i]), proto);
+	    serv = getservbyport (htons (atol (key[i])), proto);
 	  else
 	    serv = getservbyname (key[i], proto);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]