blob: 5875b81b2fcff7e0de9208b81508aa871afd68a8 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Upstream-Status: Backport
2
3diff -ruN tcp_wrappers_7.6.orig/rfc931.c tcp_wrappers_7.6/rfc931.c
4--- tcp_wrappers_7.6.orig/rfc931.c 2004-08-29 18:40:08.000000000 +0200
5+++ tcp_wrappers_7.6/rfc931.c 2004-08-29 18:40:02.000000000 +0200
6@@ -92,6 +92,8 @@
7 char *cp;
8 char *result = unknown;
9 FILE *fp;
10+ unsigned saved_timeout;
11+ struct sigaction nact, oact;
12
13 #ifdef INET6
14 /* address family must be the same */
15@@ -134,7 +136,12 @@
16 */
17
18 if (setjmp(timebuf) == 0) {
19- signal(SIGALRM, timeout);
20+ /* Save SIGALRM timer and handler. Sudheer Abdul-Salam, SUN. */
21+ saved_timeout = alarm(0);
22+ nact.sa_handler = timeout;
23+ nact.sa_flags = 0;
24+ (void) sigemptyset(&nact.sa_mask);
25+ (void) sigaction(SIGALRM, &nact, &oact);
26 alarm(rfc931_timeout);
27
28 /*
29@@ -223,6 +230,10 @@
30 }
31 alarm(0);
32 }
33+ /* Restore SIGALRM timer and handler. Sudheer Abdul-Salam, SUN. */
34+ (void) sigaction(SIGALRM, &oact, NULL);
35+ if (saved_timeout > 0)
36+ alarm(saved_timeout);
37 fclose(fp);
38 }
39 STRN_CPY(dest, result, STRING_LENGTH);