Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
12b2506
)
e2fsck: check new sysfs interface to determine if we are on battery
author
Theodore Ts'o
<tytso@mit.edu>
Tue, 21 Feb 2012 00:10:19 +0000
(19:10 -0500)
committer
Theodore Ts'o
<tytso@mit.edu>
Tue, 21 Feb 2012 00:10:19 +0000
(19:10 -0500)
...since the old way is deprecated.
Addresses-SourceForge-Bug: #3439277
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/unix.c
patch
|
blob
|
history
diff --git
a/e2fsck/unix.c
b/e2fsck/unix.c
index
c38b67a
..
6f97b0f
100644
(file)
--- 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)