diff options
-rw-r--r-- | modules/devices/battery.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/modules/devices/battery.c b/modules/devices/battery.c index 09c84eeb..58ec0d0d 100644 --- a/modules/devices/battery.c +++ b/modules/devices/battery.c @@ -60,8 +60,7 @@ __scan_battery_apcupsd(void) int i; apcaccess_path = find_program("apcaccess"); - - if ((apcaccess = popen(apcaccess_path, "r"))) { + if (apcaccess_path && (apcaccess = popen(apcaccess_path, "r"))) { /* first line isn't important */ if (fgets(buffer, 512, apcaccess)) { /* allocate the key, value hash table */ |