lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1329783103-4017-1-git-send-email-tytso@mit.edu>
Date:	Mon, 20 Feb 2012 19:11:43 -0500
From:	Theodore Ts'o <tytso@....edu>
To:	Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc:	Theodore Ts'o <tytso@....edu>
Subject: [PATCH] e2fsck: check new sysfs interface to determine if we are on battery

...since the old way is deprecated.

Addresses-SourceForge-Bug: #3439277

Signed-off-by: "Theodore Ts'o" <tytso@....edu>
---
 e2fsck/unix.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index c38b67a..6f97b0f 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -252,6 +252,14 @@ static int is_on_batt(void)
 	unsigned int	acflag;
 	struct dirent*	de;
 
+	f = fopen("/sys/class/power_supply/AC/online", "r");
+	if (f) {
+		if (fscanf(f, "%d\n", &acflag) == 1) {
+			fclose(f);
+			return (!acflag);
+		}
+		fclose(f);
+	}
 	f = fopen("/proc/apm", "r");
 	if (f) {
 		if (fscanf(f, "%s %s %s %x", tmp, tmp, tmp, &acflag) != 4)
-- 
1.7.9.107.g97f9a

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ