923a60
From a2911c593e9d69a2aa01d89d876e313f90e7db17 Mon Sep 17 00:00:00 2001
923a60
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
923a60
Date: Tue, 3 Mar 2015 19:07:28 -0500
923a60
Subject: [PATCH] shared/util: assume ac when /sys/class/power_supply is
923a60
 missing
923a60
923a60
On s390 (at least) /sys/class/power_supply is not present. We should
923a60
treat this like if this directory was empty, and not an error.
923a60
923a60
(cherry picked from commit 6d89003462484c8656b698e07b9cf0a337e3818e)
923a60
---
923a60
 src/shared/util.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/shared/util.c b/src/shared/util.c
923a60
index f24b5b4ec5..85487230a2 100644
923a60
--- a/src/shared/util.c
923a60
+++ b/src/shared/util.c
923a60
@@ -5994,7 +5994,7 @@ int on_ac_power(void) {
923a60
 
923a60
         d = opendir("/sys/class/power_supply");
923a60
         if (!d)
923a60
-                return -errno;
923a60
+                return errno == ENOENT ? true : -errno;
923a60
 
923a60
         for (;;) {
923a60
                 struct dirent *de;