summaryrefslogtreecommitdiff
path: root/src/pm-action.in
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-03-15 17:07:49 -0500
committerVictor Lowther <victor.lowther@gmail.com>2008-03-15 17:07:49 -0500
commitde8659ed4bb5d42251ee8695fc54642dbcce0604 (patch)
treef1c2ffc21ed50d2f660cb2439e05d22d6d19a14e /src/pm-action.in
parent962304a9279c244c9cdc1328cb800dd6bd49736e (diff)
Moved locking in pm-action.
This fixes a help-related bug that Michael Biebl noted.
Diffstat (limited to 'src/pm-action.in')
-rw-r--r--src/pm-action.in9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/pm-action.in b/src/pm-action.in
index a6ea68c..204c0e5 100644
--- a/src/pm-action.in
+++ b/src/pm-action.in
@@ -42,6 +42,11 @@ if [ "$(id -u)" != "0" ]; then
echo This utility may only be run by the root user. 1>&2
exit 1
fi
+#
+take_suspend_lock || exit 1
+
+# make sure we release the lock no matter how we exit
+trap remove_suspend_lock 0
# Save the command line options for the hooks
while [ $# -gt 0 ]
@@ -61,10 +66,6 @@ case "$ACTION" in
esac
"check_$ACTION" || { echo "System does not support $ACTION sleep."; exit 1; }
-take_suspend_lock || exit 1
-
-# make sure we release the lock no matter how we exit
-trap remove_suspend_lock 0
init_logfile "${PM_LOGFILE}"
# Make sure we are not inhibited before we start.