rcmd in glibc 2.1.90

Jakub Jelinek jakub@redhat.com
Wed May 17 03:55:00 GMT 2000


Hi!

When I try with glibc 2.1.90
rlogin foobar
I get

rcmd: getaddrinfo: Name or service not known

error message printed on the screen.
IMHO glibc 2.1.x error message was much better:

foobar: Unknown host

This patch changes this, alternatively we could just kill the rcmd:
getaddrinfo: and replace it with %s: (*ahost).

Also, I've noticed that if the local domain is not specified in search in
/etc/resolv.conf, then getaddrinfo does not resolve dotless names while it
did in glibc 2.1.
Say I'm on
foo.mydomain.cz
my /etc/resolv.conf does not contain any search line.
With glibc 2.1
rlogin bar
works (provided bar.mydomain.cz exists), while with 2.2 it fails.
Is that desired behaviour or just a bug?

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

	* inet/rcmd.c (rcmd_af): If *ahost cannot be resolved, include
	unresolved hostname in the message.

--- libc/inet/rcmd.c.jj	Tue May  9 13:47:33 2000
+++ libc/inet/rcmd.c	Wed May 17 12:35:11 2000
@@ -134,9 +134,12 @@ rcmd_af(ahost, rport, locuser, remuser, 
 	(void)snprintf(num, sizeof(num), "%d", ntohs(rport));
 	error = getaddrinfo(*ahost, num, &hints, &res);
 	if (error) {
-	    fprintf(stderr, "rcmd: getaddrinfo: %s\n",
-		    gai_strerror(error));
-                return (-1);
+	    if (error == EAI_NONAME && *ahost != NULL)
+	        fprintf(stderr, "%s: Unknown host\n", *ahost);
+	    else
+		fprintf(stderr, "rcmd: getaddrinfo: %s\n",
+			gai_strerror(error));
+	    return (-1);
 	}
 
 	pfd[0].events = POLLIN;

	Jakub


More information about the Libc-hacker mailing list