diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2011-12-30 19:42:13 -0200 |
---|---|---|
committer | Leandro Pereira <leandro@hardinfo.org> | 2011-12-30 19:42:13 -0200 |
commit | 9bf0c669435d6d307d4d678e80bd01736705bdb8 (patch) | |
tree | ffa5066d739f505f8363d646ad88120c70e91b7d | |
parent | 8e3c3a5eda7817b012423b3faae788b369119834 (diff) |
Fix "sh: -c: option requires an argument" when no apcaccess binary is available
Closes http://bugs.hardinfo.org/showreport.php?bugid=59
-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 */ |