summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorMichael Biebl <mbiebl@gmail.com>2008-04-07 10:55:05 +0200
committerMichael Biebl <mbiebl@gmail.com>2008-04-07 10:55:05 +0200
commit93af881ac18718c8eae7f575c3f30396791b0e75 (patch)
treeb4185d03053497e7819c6b213be9970f2662cab8 /pm
parent4b527b7b88e146e9633a11337e3055d282b5c281 (diff)
Add safety check before writing mode to /sys/power/disk
Be extra paranoid and only set HIBERNATE_MODE if it is actually supported.
Diffstat (limited to 'pm')
-rwxr-xr-xpm/module.d/kernel5
1 files changed, 3 insertions, 2 deletions
diff --git a/pm/module.d/kernel b/pm/module.d/kernel
index ee2f75f..cebcd98 100755
--- a/pm/module.d/kernel
+++ b/pm/module.d/kernel
@@ -22,8 +22,9 @@ check_hibernate()
do_hibernate()
{
- [ "$HIBERNATE_MODE" ] && \
- echo -n "${HIBERNATE_MODE}" > /sys/power/disk
+ [ -n "${HIBERNATE_MODE}" ] && \
+ grep -q "${HIBERNATE_MODE}" /sys/power/disk && \
+ echo -n "${HIBERNATE_MODE}" > /sys/power/disk
echo -n "disk" > /sys/power/state
}