~ubuntu-branches/ubuntu/wily/apmd/wily

« back to all changes in this revision

Viewing changes to debian/patches/legacy.patch

  • Committer: Package Import Robot
  • Author(s): Anibal Monsalve Salazar, Helmut Grohne, Anibal Monsalve Salazar
  • Date: 2014-10-16 10:57:57 UTC
  • mfrom: (8.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20141016105757-jj815lygfphf0dgb
Tags: 3.2.2-15
[ Helmut Grohne ]
* libtool is now in package libtool-bin. Adapt Build-Depends.
  Closes: #761731.

[ Anibal Monsalve Salazar ]
* Standards-Version is 3.9.6.
* Source format set to 3.0 (quilt).
* debhelper compatibility is 9.
* Fix debian-rules-missing-recommended-target build-indep.
* Fix hardening-no-relro.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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=
 
6
 
 
7
 CC=gcc
 
8
 CFLAGS=-O -g
 
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
 
17
+++ apmd-3.2.2/apm.c
 
18
@@ -219,12 +219,13 @@ int main(int argc, char **argv)
 
19
                }
 
20
        }
 
21
                                                                                                            
 
22
-
 
23
+#if 0
 
24
     if (!(i.apm_flags & APM_32_BIT_SUPPORT))
 
25
     {
 
26
        fprintf(stderr, "32-bit APM interface not supported\n");
 
27
        exit(1);
 
28
     }
 
29
+#endif
 
30
 
 
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
 
36
+++ apmd-3.2.2/apm.h
 
37
@@ -20,6 +20,13 @@
 
38
  * $Id: apm.h,v 1.7 1999/07/05 22:31:11 apenwarr Exp $
 
39
  * 
 
40
  */
 
41
+#ifndef _APM_H
 
42
+#define _APM_H 1
 
43
+
 
44
+#ifndef __KERNEL_STRICT_NAMES
 
45
+#define __KERNEL_STRICT_NAMES
 
46
+#endif
 
47
+
 
48
 #include <linux/apm_bios.h>
 
49
 #include <sys/types.h>
 
50
 
 
51
@@ -93,3 +100,5 @@ extern int apm_reject(int fd);
 
52
 #else
 
53
 #define apm_reject(fd)   (-EINVAL)
 
54
 #endif
 
55
+
 
56
+#endif
 
57
Index: apmd-3.2.2/apmd.c
 
58
===================================================================
 
59
--- apmd-3.2.2.orig/apmd.c
 
60
+++ apmd-3.2.2/apmd.c
 
61
@@ -343,7 +343,7 @@ static int call_proxy(apm_event_t event)
 
62
                /* parent */
 
63
                int status, retval;
 
64
                ssize_t len;
 
65
-               time_t time_limit;
 
66
+               time_t countdown;
 
67
 
 
68
                if (pid < 0) {
 
69
                        /* Couldn't fork */
 
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 */
 
72
                close(fds[1]);
 
73
                fcntl(fds[0], F_SETFL, O_RDONLY|O_NONBLOCK);
 
74
-               time_limit = time(0) + proxy_timeout;
 
75
+               countdown = proxy_timeout;
 
76
                do {
 
77
+                       countdown -= 1;
 
78
                        while ((len = read(fds[0], line, sizeof(line)-1)) > 0) {
 
79
                                line[len] = 0;
 
80
                                APMD_SYSLOG(LOG_INFO, "+ %s", line);
 
81
@@ -372,16 +373,16 @@ static int call_proxy(apm_event_t event)
 
82
                                goto proxy_done;
 
83
                        }
 
84
                                
 
85
-                       sleep(1);
 
86
+                       while (sleep(1) > 0) ;
 
87
                } while (
 
88
-                       (time(0) < time_limit)
 
89
+                       (countdown >= 0)
 
90
                        || (proxy_timeout < 0)
 
91
                );
 
92
 
 
93
                APMD_SYSLOG(LOG_NOTICE, "Proxy has been running more than %d seconds; killing it", proxy_timeout);
 
94
 
 
95
                kill(pid, SIGTERM);
 
96
-               time_limit = time(0) + 5;
 
97
+               countdown = 5;
 
98
                do {
 
99
                        retval = waitpid(pid, &status, WNOHANG);
 
100
                        if (retval == pid)
 
101
@@ -392,9 +393,9 @@ static int call_proxy(apm_event_t event)
 
102
                                goto proxy_done;
 
103
                        }
 
104
 
 
105
-                       sleep(1);
 
106
+                       while (sleep(1) > 0) ;
 
107
 
 
108
-               } while (time(0) < time_limit);
 
109
+               } while (countdown >= 0);
 
110
 
 
111
                kill(pid, SIGKILL);
 
112
                status = __W_EXITCODE(0, SIGKILL);