1
Index: apmd-3.2.2/Makefile
2
===================================================================
3
--- apmd-3.2.2.orig/Makefile
4
+++ apmd-3.2.2/Makefile
5
@@ -43,7 +43,7 @@ DESTDIR=
9
-XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include \
10
+XTRACFLAGS=-Wall -pipe -I. -I/usr/src/linux/include -I/usr/X11R6/include \
11
-I/usr/src/linux-2.2/include -I /usr/src/linux-2.0/include \
12
-DVERSION=\"$(VERSION)\" \
13
-DDEFAULT_PROXY_NAME=\"$(PROXY_DIR)/apmd_proxy\"
14
Index: apmd-3.2.2/apm.c
15
===================================================================
16
--- apmd-3.2.2.orig/apm.c
18
@@ -219,12 +219,13 @@ int main(int argc, char **argv)
24
if (!(i.apm_flags & APM_32_BIT_SUPPORT))
26
fprintf(stderr, "32-bit APM interface not supported\n");
31
if (verbose && (i.apm_flags & 0x10))
32
printf("APM BIOS Power Management is currently disabled\n");
33
Index: apmd-3.2.2/apm.h
34
===================================================================
35
--- apmd-3.2.2.orig/apm.h
38
* $Id: apm.h,v 1.7 1999/07/05 22:31:11 apenwarr Exp $
44
+#ifndef __KERNEL_STRICT_NAMES
45
+#define __KERNEL_STRICT_NAMES
48
#include <linux/apm_bios.h>
49
#include <sys/types.h>
51
@@ -93,3 +100,5 @@ extern int apm_reject(int fd);
53
#define apm_reject(fd) (-EINVAL)
57
Index: apmd-3.2.2/apmd.c
58
===================================================================
59
--- apmd-3.2.2.orig/apmd.c
61
@@ -343,7 +343,7 @@ static int call_proxy(apm_event_t event)
70
@@ -356,8 +356,9 @@ static int call_proxy(apm_event_t event)
71
/* Capture the child's output, if any, but only until it terminates */
73
fcntl(fds[0], F_SETFL, O_RDONLY|O_NONBLOCK);
74
- time_limit = time(0) + proxy_timeout;
75
+ countdown = proxy_timeout;
78
while ((len = read(fds[0], line, sizeof(line)-1)) > 0) {
80
APMD_SYSLOG(LOG_INFO, "+ %s", line);
81
@@ -372,16 +373,16 @@ static int call_proxy(apm_event_t event)
86
+ while (sleep(1) > 0) ;
88
- (time(0) < time_limit)
90
|| (proxy_timeout < 0)
93
APMD_SYSLOG(LOG_NOTICE, "Proxy has been running more than %d seconds; killing it", proxy_timeout);
96
- time_limit = time(0) + 5;
99
retval = waitpid(pid, &status, WNOHANG);
101
@@ -392,9 +393,9 @@ static int call_proxy(apm_event_t event)
106
+ while (sleep(1) > 0) ;
108
- } while (time(0) < time_limit);
109
+ } while (countdown >= 0);
112
status = __W_EXITCODE(0, SIGKILL);