summaryrefslogtreecommitdiffstats
path: root/meta/packages/apmd/apmd-3.2.2/debian.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages/apmd/apmd-3.2.2/debian.patch')
-rw-r--r--meta/packages/apmd/apmd-3.2.2/debian.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/packages/apmd/apmd-3.2.2/debian.patch b/meta/packages/apmd/apmd-3.2.2/debian.patch
new file mode 100644
index 0000000000..d49e524bbd
--- /dev/null
+++ b/meta/packages/apmd/apmd-3.2.2/debian.patch
@@ -0,0 +1,54 @@
1--- apmd-3.2.2.orig/apmd.c
2+++ apmd-3.2.2/apmd.c
3@@ -343,7 +343,7 @@
4 /* parent */
5 int status, retval;
6 ssize_t len;
7- time_t time_limit;
8+ time_t countdown;
9
10 if (pid < 0) {
11 /* Couldn't fork */
12@@ -356,8 +356,9 @@
13 /* Capture the child's output, if any, but only until it terminates */
14 close(fds[1]);
15 fcntl(fds[0], F_SETFL, O_RDONLY|O_NONBLOCK);
16- time_limit = time(0) + proxy_timeout;
17+ countdown = proxy_timeout;
18 do {
19+ countdown -= 1;
20 while ((len = read(fds[0], line, sizeof(line)-1)) > 0) {
21 line[len] = 0;
22 APMD_SYSLOG(LOG_INFO, "+ %s", line);
23@@ -372,16 +373,16 @@
24 goto proxy_done;
25 }
26
27- sleep(1);
28+ while (sleep(1) > 0) ;
29 } while (
30- (time(0) < time_limit)
31+ (countdown >= 0)
32 || (proxy_timeout < 0)
33 );
34
35 APMD_SYSLOG(LOG_NOTICE, "Proxy has been running more than %d seconds; killing it", proxy_timeout);
36
37 kill(pid, SIGTERM);
38- time_limit = time(0) + 5;
39+ countdown = 5;
40 do {
41 retval = waitpid(pid, &status, WNOHANG);
42 if (retval == pid)
43@@ -392,9 +393,9 @@
44 goto proxy_done;
45 }
46
47- sleep(1);
48+ while (sleep(1) > 0) ;
49
50- } while (time(0) < time_limit);
51+ } while (countdown >= 0);
52
53 kill(pid, SIGKILL);
54 status = __W_EXITCODE(0, SIGKILL);