Files
ports/sysutils/battmond/files/patch-battmond.c
Alexandre C. Guimarães b64f1988e3 sysutils/battmond: Fix battmond dies after first suspend
- Fix won't acting if battery level suddenly drops to zero
PR:		251618 251619
Submitted by:	dirtystickyfloor@web.de
Approved by:	ntarmos@gmail.com (maintainer timeout, 127 days)
2021-04-11 10:08:15 -03:00

19 lines
641 B
C

--- 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);