summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2010-09-03 13:45:49 +0200
committerJeremy Huddleston <jeremyhu@apple.com>2011-10-06 00:53:50 -0700
commitfbc307f3445a549815efb2476e9476bd51250cf6 (patch)
treec75da5f1881beb0ad64f56172b3dd0fe56563bbe
parentee3e046dfd84cda1588eef155c7e7c36df9bf5f4 (diff)
Remove alarm handler in get_hostname
gethostbyaddr is not (required to be) async-signal-safe. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--gethost.c39
1 files changed, 0 insertions, 39 deletions
diff --git a/gethost.c b/gethost.c
index 2df5a8f..375f584 100644
--- a/gethost.c
+++ b/gethost.c
@@ -74,29 +74,6 @@ in this Software without prior written authorization from The Open Group.
#include <arpa/inet.h>
#endif
-#ifdef SIGALRM
-static volatile Bool nameserver_timedout = False;
-
-
-/*
- * get_hostname - Given an internet address, return a name (CHARON.MIT.EDU)
- * or a string representing the address (18.58.0.13) if the name cannot
- * be found. Stolen from xhost.
- */
-
-static jmp_buf env;
-static RETSIGTYPE
-nameserver_lost(int sig)
-{
- nameserver_timedout = True;
- longjmp (env, -1);
- /* NOTREACHED */
-#ifdef SIGNALRETURNSINT
- return -1; /* for picky compilers */
-#endif
-}
-#endif
-
const char *
get_hostname (Xauth *auth)
{
@@ -124,23 +101,7 @@ get_hostname (Xauth *auth)
#endif
af = AF_INET;
if (no_name_lookups == False) {
-#ifdef SIGALRM
- /* gethostbyaddr can take a LONG time if the host does not exist.
- Assume that if it does not respond in NAMESERVER_TIMEOUT seconds
- that something is wrong and do not make the user wait.
- gethostbyaddr will continue after a signal, so we have to
- jump out of it.
- */
- nameserver_timedout = False;
- signal (SIGALRM, nameserver_lost);
- alarm (4);
- if (setjmp(env) == 0) {
-#endif
hp = gethostbyaddr (auth->address, auth->address_length, af);
-#ifdef SIGALRM
- }
- alarm (0);
-#endif
}
if (hp)
return (hp->h_name);