summaryrefslogtreecommitdiff
blob: 8547b075efdea0edbfc3862013e723e2305516f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
http://bugs.gentoo.org/122784

Index: src/tryto.c
===================================================================
RCS file: /var/lib/cvs/socklog/src/tryto.c,v
retrieving revision 1.8
diff -u -r1.8 tryto.c
--- admin/socklog-2.0.2/src/tryto.c	6 Feb 2005 11:36:50 -0000	1.8
+++ admin/socklog-2.0.2/src/tryto.c	14 Feb 2006 12:34:04 -0000
@@ -104,6 +104,7 @@
   taia_now(&now);
   taia_uint(&deadline, timeout);
   taia_add(&deadline, &now, &deadline);
+  timeout =0;
 
   for (;;) {
     int iopausefds;
@@ -163,16 +164,16 @@
       int i;
       char *s;
 
-      if (wait_nohang(&rc) == pid) break;
-      taia_now(&now);
-      if ((timeout =taia_less(&deadline, &now))) break;
-
       sig_unblock(sig_child);
       iopause(x, iopausefds, &deadline, &now);
       sig_block(sig_child);
       
       while (read(selfpipe[0], &ch, 1) == 1) {}
 
+      taia_now(&now);
+      if ((timeout =taia_less(&deadline, &now))) break;
+      if (wait_nohang(&rc) == pid) break;
+
       r = buffer_feed(&buffer_x);
       if (r < 0) {
 	if ((errno == error_intr) || (errno == error_again)) continue;
@@ -201,6 +202,7 @@
     close(cpipe[1]);
 
     if (timeout) {
+      if (wait_nohang(&rc) == pid) break;
       /* child not finished */
       strerr_warn4(WARNING,
 		   "child \"", *argv, "\" timed out. sending TERM...", 0);