This is the mail archive of the libc-hacker@sourceware.cygnus.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]

[PATCH] rcmd bug fix


Hi!

This patch fixes rsh with glibc 2.1.90, otherwise I get
rcmd: socket: All ports in use
(obviously, because i is initialized with random garbage as seen by strace).

2000-05-29  Jakub Jelinek  <jakub@redhat.com>

	* inet/rcmd.c (rresvport_af): Use correct port number.

--- libc/inet/rcmd.c.jj	Mon May  8 14:30:39 2000
+++ libc/inet/rcmd.c	Mon May 29 16:59:49 2000
@@ -340,11 +340,9 @@ rresvport_af(alport, family)
 	ss.__ss_family = family;
 
 	for (;;) {
-		*sport = htons(i);
-		if (bind(s, (struct sockaddr *)&ss, len) >= 0){
-			*alport = i;
+		*sport = htons((uint16_t) *alport);
+		if (bind(s, (struct sockaddr *)&ss, len) >= 0)
 			return s;
-		}
 		if (errno != EADDRINUSE) {
 			(void)__close(s);
 			return -1;

	Jakub

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