From 520ec963af2e012caa5609ad2fac041f6e7af6d7 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 31 Dec 2003 21:44:08 +0000 Subject: Update. * inet/rcmd.c: Provide better error message in case of unknown host. Remove USE_IN_LIBIO. * nscd/nscd.init: Updated version, more conforming with current init file standards. * nscd/nscd-client.h (_PATH_NSCDPID): Move the file into /var/run/nscd directory. (_PATH_NSCDSOCKET): Likewise. * test-skeleton.c (timeout_handler): Fix error message. --- inet/rcmd.c | 48 +++++++++++++++--------------------------------- 1 file changed, 15 insertions(+), 33 deletions(-) (limited to 'inet') diff --git a/inet/rcmd.c b/inet/rcmd.c index d9645a3..0bcb731 100644 --- a/inet/rcmd.c +++ b/inet/rcmd.c @@ -80,9 +80,7 @@ static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94"; #include #include #include -#ifdef USE_IN_LIBIO -# include -#endif +#include #include @@ -139,14 +137,20 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) (void)__snprintf(num, sizeof(num), "%d", ntohs(rport)); error = getaddrinfo(*ahost, num, &hints, &res); if (error) { -#ifdef USE_IN_LIBIO - if (_IO_fwide (stderr, 0) > 0) - __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n", - gai_strerror(error)); - else -#endif - fprintf(stderr, "rcmd: getaddrinfo: %s\n", - gai_strerror(error)); + if (error == EAI_NONAME && *ahost != NULL) { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"%s: Unknown host\n", + *ahost); + else + fprintf(stderr, "%s: Unknown host\n", *ahost); + } else { + if (_IO_fwide (stderr, 0) > 0) + __fwprintf(stderr, L"rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + else + fprintf(stderr, "rcmd: getaddrinfo: %s\n", + gai_strerror(error)); + } return (-1); } @@ -157,12 +161,10 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) free (ahostbuf); ahostbuf = strdup (res->ai_canonname); if (ahostbuf == NULL) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf(stderr, L"%s", _("rcmd: Cannot allocate memory\n")); else -#endif fputs(_("rcmd: Cannot allocate memory\n"), stderr); return (-1); @@ -179,21 +181,17 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) s = rresvport_af(&lport, ai->ai_family); if (s < 0) { if (errno == EAGAIN) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf(stderr, L"%s", _("rcmd: socket: All ports in use\n")); else -#endif fputs(_("rcmd: socket: All ports in use\n"), stderr); } else { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf(stderr, L"rcmd: socket: %m\n"); else -#endif fprintf(stderr, "rcmd: socket: %m\n"); } __sigsetmask(oldmask); @@ -222,11 +220,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) if (__asprintf (&buf, _("connect to address %s: "), paddr) >= 0) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } @@ -239,11 +235,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) NI_NUMERICHOST); if (__asprintf (&buf, _("Trying %s...\n"), paddr) >= 0) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } @@ -257,13 +251,11 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) continue; } freeaddrinfo(res); -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void)__fwprintf(stderr, L"%s: %s\n", *ahost, __strerror_r(errno, errbuf, sizeof (errbuf))); else -#endif (void)fprintf(stderr, "%s: %s\n", *ahost, __strerror_r(errno, errbuf, sizeof (errbuf))); @@ -289,11 +281,9 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) if (__asprintf (&buf, _("\ rcmd: write (setting up stderr): %m\n")) >= 0) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf(stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } @@ -313,11 +303,9 @@ rcmd: poll (setting up stderr): %m\n")) >= 0) && __asprintf(&buf, _("\ poll: protocol failure in circuit setup\n")) >= 0)) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } @@ -339,12 +327,10 @@ poll: protocol failure in circuit setup\n")) >= 0)) } (void)__close(s2); if (s3 < 0) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) (void)__fwprintf(stderr, L"rcmd: accept: %m\n"); else -#endif (void)fprintf(stderr, "rcmd: accept: %m\n"); lport = 0; @@ -358,11 +344,9 @@ poll: protocol failure in circuit setup\n")) >= 0)) if (__asprintf(&buf, _("\ socket: protocol failure in circuit setup\n")) >= 0) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } @@ -389,11 +373,9 @@ socket: protocol failure in circuit setup\n")) >= 0) || (n != 0 && __asprintf(&buf, "rcmd: %s: %m\n", *ahost) >= 0)) { -#ifdef USE_IN_LIBIO if (_IO_fwide (stderr, 0) > 0) __fwprintf (stderr, L"%s", buf); else -#endif fputs (buf, stderr); free (buf); } -- cgit v1.1