xbattmon

simple battery monitor for X
git clone git://git.2f30.org/xbattmon
Log | Files | Refs | README | LICENSE

commit e8c5cfcfde19c1aa51820c5dda84f455daf1ffce
parent 10e94bc186026cc1758c45ecdc1b7d6a47d0ff1d
Author: sin <sin@2f30.org>
Date:   Mon, 31 Jul 2017 16:02:15 +0100

Close fd early for consistency with OpenBSD pollbat()

Diffstat:
Mxbattmon.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xbattmon.c b/xbattmon.c @@ -258,11 +258,12 @@ pollbat(void) r = ioctl(fd, APMIO_GETINFO, &ai); if (r < 0) err(1, "APMIO_GETINFO %s", PATH_APM); + close(fd); + batcap = ai.ai_batt_life; if (batcap > maxcap) batcap = maxcap; state = ai.ai_acline ? AC_ON : AC_OFF; - close(fd); } #elif __linux__ void