From fbc307f3445a549815efb2476e9476bd51250cf6 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 3 Sep 2010 13:45:49 +0200 Subject: Remove alarm handler in get_hostname gethostbyaddr is not (required to be) async-signal-safe. Signed-off-by: Jeremy Huddleston --- gethost.c | 39 --------------------------------------- 1 file changed, 39 deletions(-) (limited to 'gethost.c') 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 #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); -- cgit v1.2.1