From 973110680c094b7a3bbcebbfbafb9abfc7adc8fd Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 29 Dec 2014 12:39:58 -0800 Subject: Fix previous patch to match its commit message --- src/sysdep.c | 106 ----------------------------------------------------------- 1 file changed, 106 deletions(-) (limited to 'src') diff --git a/src/sysdep.c b/src/sysdep.c index b4a9be1eb1a..013c86b859d 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1406,17 +1406,6 @@ setup_pty (int fd) } #endif /* HAVE_PTYS */ -#ifdef HAVE_SOCKETS -#include -#include -#endif /* HAVE_SOCKETS */ - -#ifdef TRY_AGAIN -#ifndef HAVE_H_ERRNO -extern int h_errno; -#endif -#endif /* TRY_AGAIN */ - void init_system_name (void) { @@ -1447,101 +1436,6 @@ init_system_name (void) hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1, min (PTRDIFF_MAX, SIZE_MAX), 1); } -#ifdef HAVE_SOCKETS - /* Turn the hostname into the official, fully-qualified hostname. - Don't do this if we're going to dump; this can confuse system - libraries on some machines and make the dumped emacs core dump. */ -#ifndef CANNOT_DUMP - if (initialized) -#endif /* not CANNOT_DUMP */ - if (! strchr (hostname, '.')) - { - int count; -#ifdef HAVE_GETADDRINFO - struct addrinfo *res; - struct addrinfo hints; - int ret; - - memset (&hints, 0, sizeof (hints)); - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_CANONNAME; - - for (count = 0;; count++) - { - if ((ret = getaddrinfo (hostname, NULL, &hints, &res)) == 0 - || ret != EAI_AGAIN) - break; - - if (count >= 5) - break; - Fsleep_for (make_number (1), Qnil); - } - - if (ret == 0) - { - struct addrinfo *it = res; - while (it) - { - char *fqdn = it->ai_canonname; - if (fqdn && strchr (fqdn, '.') - && strcmp (fqdn, "localhost.localdomain") != 0) - break; - it = it->ai_next; - } - if (it) - { - ptrdiff_t len = strlen (it->ai_canonname); - if (hostname_size <= len) - { - hostname_size = len + 1; - hostname = hostname_alloc = xrealloc (hostname_alloc, - hostname_size); - } - strcpy (hostname, it->ai_canonname); - } - freeaddrinfo (res); - } -#else /* !HAVE_GETADDRINFO */ - struct hostent *hp; - for (count = 0;; count++) - { - -#ifdef TRY_AGAIN - h_errno = 0; -#endif - hp = gethostbyname (hostname); -#ifdef TRY_AGAIN - if (! (hp == 0 && h_errno == TRY_AGAIN)) -#endif - - break; - - if (count >= 5) - break; - Fsleep_for (make_number (1), Qnil); - } - - if (hp) - { - char *fqdn = (char *) hp->h_name; - - if (!strchr (fqdn, '.')) - { - /* We still don't have a fully qualified domain name. - Try to find one in the list of alternate names */ - char **alias = hp->h_aliases; - while (*alias - && (!strchr (*alias, '.') - || !strcmp (*alias, "localhost.localdomain"))) - alias++; - if (*alias) - fqdn = *alias; - } - hostname = fqdn; - } -#endif /* !HAVE_GETADDRINFO */ - } -#endif /* HAVE_SOCKETS */ #endif /* HAVE_GETHOSTNAME */ char *p; for (p = hostname; *p; p++) -- cgit v1.2.1