aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2014-12-29 12:39:58 -0800
committerPaul Eggert2014-12-29 12:42:07 -0800
commit973110680c094b7a3bbcebbfbafb9abfc7adc8fd (patch)
treed4a329e7633a0e2e685c9cf2b7476a771de6006c /src
parentf9acac751d4cd22480e62cc63936b1208ca9fe48 (diff)
downloademacs-973110680c094b7a3bbcebbfbafb9abfc7adc8fd.tar.gz
emacs-973110680c094b7a3bbcebbfbafb9abfc7adc8fd.zip
Fix previous patch to match its commit message
Diffstat (limited to 'src')
-rw-r--r--src/sysdep.c106
1 files changed, 0 insertions, 106 deletions
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)
1406} 1406}
1407#endif /* HAVE_PTYS */ 1407#endif /* HAVE_PTYS */
1408 1408
1409#ifdef HAVE_SOCKETS
1410#include <sys/socket.h>
1411#include <netdb.h>
1412#endif /* HAVE_SOCKETS */
1413
1414#ifdef TRY_AGAIN
1415#ifndef HAVE_H_ERRNO
1416extern int h_errno;
1417#endif
1418#endif /* TRY_AGAIN */
1419
1420void 1409void
1421init_system_name (void) 1410init_system_name (void)
1422{ 1411{
@@ -1447,101 +1436,6 @@ init_system_name (void)
1447 hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1, 1436 hostname = hostname_alloc = xpalloc (hostname_alloc, &hostname_size, 1,
1448 min (PTRDIFF_MAX, SIZE_MAX), 1); 1437 min (PTRDIFF_MAX, SIZE_MAX), 1);
1449 } 1438 }
1450#ifdef HAVE_SOCKETS
1451 /* Turn the hostname into the official, fully-qualified hostname.
1452 Don't do this if we're going to dump; this can confuse system
1453 libraries on some machines and make the dumped emacs core dump. */
1454#ifndef CANNOT_DUMP
1455 if (initialized)
1456#endif /* not CANNOT_DUMP */
1457 if (! strchr (hostname, '.'))
1458 {
1459 int count;
1460#ifdef HAVE_GETADDRINFO
1461 struct addrinfo *res;
1462 struct addrinfo hints;
1463 int ret;
1464
1465 memset (&hints, 0, sizeof (hints));
1466 hints.ai_socktype = SOCK_STREAM;
1467 hints.ai_flags = AI_CANONNAME;
1468
1469 for (count = 0;; count++)
1470 {
1471 if ((ret = getaddrinfo (hostname, NULL, &hints, &res)) == 0
1472 || ret != EAI_AGAIN)
1473 break;
1474
1475 if (count >= 5)
1476 break;
1477 Fsleep_for (make_number (1), Qnil);
1478 }
1479
1480 if (ret == 0)
1481 {
1482 struct addrinfo *it = res;
1483 while (it)
1484 {
1485 char *fqdn = it->ai_canonname;
1486 if (fqdn && strchr (fqdn, '.')
1487 && strcmp (fqdn, "localhost.localdomain") != 0)
1488 break;
1489 it = it->ai_next;
1490 }
1491 if (it)
1492 {
1493 ptrdiff_t len = strlen (it->ai_canonname);
1494 if (hostname_size <= len)
1495 {
1496 hostname_size = len + 1;
1497 hostname = hostname_alloc = xrealloc (hostname_alloc,
1498 hostname_size);
1499 }
1500 strcpy (hostname, it->ai_canonname);
1501 }
1502 freeaddrinfo (res);
1503 }
1504#else /* !HAVE_GETADDRINFO */
1505 struct hostent *hp;
1506 for (count = 0;; count++)
1507 {
1508
1509#ifdef TRY_AGAIN
1510 h_errno = 0;
1511#endif
1512 hp = gethostbyname (hostname);
1513#ifdef TRY_AGAIN
1514 if (! (hp == 0 && h_errno == TRY_AGAIN))
1515#endif
1516
1517 break;
1518
1519 if (count >= 5)
1520 break;
1521 Fsleep_for (make_number (1), Qnil);
1522 }
1523
1524 if (hp)
1525 {
1526 char *fqdn = (char *) hp->h_name;
1527
1528 if (!strchr (fqdn, '.'))
1529 {
1530 /* We still don't have a fully qualified domain name.
1531 Try to find one in the list of alternate names */
1532 char **alias = hp->h_aliases;
1533 while (*alias
1534 && (!strchr (*alias, '.')
1535 || !strcmp (*alias, "localhost.localdomain")))
1536 alias++;
1537 if (*alias)
1538 fqdn = *alias;
1539 }
1540 hostname = fqdn;
1541 }
1542#endif /* !HAVE_GETADDRINFO */
1543 }
1544#endif /* HAVE_SOCKETS */
1545#endif /* HAVE_GETHOSTNAME */ 1439#endif /* HAVE_GETHOSTNAME */
1546 char *p; 1440 char *p;
1547 for (p = hostname; *p; p++) 1441 for (p = hostname; *p; p++)