summaryrefslogtreecommitdiff
path: root/sysutils/battmond/files/patch-battmond.c
blob: 1da5a1b6eb424866c393dea37f5ba3ef764dba59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
--- battmond.c.orig	2021-04-11 13:03:15 UTC
+++ battmond.c
@@ -189,13 +189,12 @@ int main(int argc, char ** argv)
 #ifdef DEBUG
 		fprintf(stderr, "Total battery capacity: %d%%\n", total_cap);
 #endif
-		if (num_discharging && !num_charging && total_cap > 0) {
+		if (num_discharging && !num_charging && total_cap >= 0) {
 			if (total_cap <= halt) {
 				if (dosuspend) { // Suspend
 					syslog(LOG_EMERG, BATT_SUSP);
 					close(acpifd);
-					execl("/usr/sbin/acpiconf", "acpiconf", "-s3", NULL);
-					oops("execl");
+					system("/usr/sbin/acpiconf -s3");
 				} else { // Halt
 					syslog(LOG_EMERG, BATT_HALT);
 					close(acpifd);