add packages_10.03.2 in preparation for the 10.03.2 interim release
[10.03/packages.git] / net / redir / patches / 04_fix_timeouts.patch
1 diff -Nur a/redir.c b/redir.c
2 --- a/redir.c   2005-10-22 22:44:39.504061784 -0400
3 +++ b/redir.c   2005-10-22 22:47:14.746461352 -0400
4 @@ -598,10 +598,6 @@
5         /* Record start time */
6         start_time = (unsigned int) time(NULL);
7  
8 -       /* Set up timeout */
9 -       timeout.tv_sec = timeout_secs;
10 -       timeout.tv_usec = 0;
11 -
12         /* file descriptor bits */
13         FD_ZERO(&iofds);
14         FD_SET(insock, &iofds);
15 @@ -618,14 +614,21 @@
16         while(1) {
17                 (void) memcpy(&c_iofds, &iofds, sizeof(iofds));
18  
19 +               /* Set up timeout, Linux returns seconds left in this structure
20 +                * so we have to reset it before each select(). */
21 +               timeout.tv_sec = timeout_secs;
22 +               timeout.tv_usec = 0;
23 +
24  
25                 if (select(max_fd + 1,
26                            &c_iofds,
27                            (fd_set *)0,
28                            (fd_set *)0,
29                            (timeout_secs ? &timeout : NULL)) <= 0) {
30 -                       /*          syslog(LLEV,"connection timeout: %d sec",timeout.tv_sec);*/
31 -                       break;
32 +                 if (dosyslog) {
33 +                   syslog(LOG_NOTICE,"connection timeout: %d sec",timeout_secs);
34 +                 }
35 +                 break;
36                 }
37  
38                 if(FD_ISSET(insock, &c_iofds)) {