summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-03 19:07:28 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-03-03 19:12:27 -0500
commit6d89003462484c8656b698e07b9cf0a337e3818e (patch)
tree57ead806edaceaf84e0f057bc6b8f40373176fb9
parente93549ef29c4123d9ee45acb5815048390201e49 (diff)
shared/util: assume ac when /sys/class/power_supply is missing
On s390 (at least) /sys/class/power_supply is not present. We should treat this like if this directory was empty, and not an error.
-rw-r--r--src/shared/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 4a970af3b1..74f29949c9 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5999,7 +5999,7 @@ int on_ac_power(void) {
d = opendir("/sys/class/power_supply");
if (!d)
- return -errno;
+ return errno == ENOENT ? true : -errno;
for (;;) {
struct dirent *de;