From 9bf0c669435d6d307d4d678e80bd01736705bdb8 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 30 Dec 2011 19:42:13 -0200 Subject: Fix "sh: -c: option requires an argument" when no apcaccess binary is available Closes http://bugs.hardinfo.org/showreport.php?bugid=59 --- modules/devices/battery.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'modules') 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 */ -- cgit v1.2.3