1 diff -ur tcp_wrappers_7.6/rfc931.c tcp_wrappers_7.6.alarm/rfc931.c
2 --- tcp_wrappers_7.6/rfc931.c Tue May 1 23:14:34 2001
3 +++ tcp_wrappers_7.6.alarm/rfc931.c Tue May 1 23:13:56 2001
6 #include <sys/socket.h>
7 #include <netinet/in.h>
14 int rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
16 -static jmp_buf timebuf;
17 +struct sigaction oldact;
20 /* fsocket - open stdio stream on top of socket */
24 /* timeout - handle timeouts */
26 -static void timeout(sig)
28 +static void timeout(int signum)
30 - longjmp(timebuf, sig);
31 + sigaction(SIGALRM,&oldact,NULL);
35 /* rfc931 - return remote user name, given socket structures */
38 char *result = unknown;
41 + struct sigaction act;
44 /* address family must be the same */
46 * Set up a timer so we won't get stuck while waiting for the server.
49 - if (setjmp(timebuf) == 0) {
50 - signal(SIGALRM, timeout);
51 - alarm(rfc931_timeout);
52 + act.sa_handler = timeout;
53 + sigemptyset(&act.sa_mask);
56 + act.sa_flags |= SA_INTERRUPT;
58 + sigaction(SIGALRM,&act,&oldact);
60 +#ifdef HAVE_SIGINTERRUPT
61 + siginterrupt(SIGALRM,1);
63 + old_alarm = alarm(rfc931_timeout);
66 * Bind the local and remote ends of the query socket to the same
73 + sigaction(SIGALRM,&oldact,NULL);
79 STRN_CPY(dest, result, STRING_LENGTH);