The owner check for sourcing config files/sleep modules is wrong, because it
doesn't allow to run pm-is-supported unprivileged.
In addition, source the sleep module after source_configs, so SLEEP_MODULE can
be configured via /etc/pm/config.d/

Please review and apply.

Michael

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From d07c3a927ab050df43bbea6bad410390a1e68db7 Mon Sep 17 00:00:00 2001
From: Michael Biebl <[EMAIL PROTECTED]>
Date: Thu, 14 Feb 2008 18:32:01 +0100
Subject: [PATCH] Replace -O with -f where appropriate

The owner check for sourcing config files/sleep modules is wrong, because it
doesn't allow to run pm-is-supported unprivileged.
In addition, source the sleep module after source_configs, so SLEEP_MODULE can
be configured via /etc/pm/config.d/
---
 pm/functions.in |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/pm/functions.in b/pm/functions.in
index b08396c..07fa468 100644
--- a/pm/functions.in
+++ b/pm/functions.in
@@ -29,16 +29,14 @@ SLEEP_MODULE="kernel"
 # Use c sort order
 export LC_COLLATE=C
 
-[ -O "${PM_UTILS_LIBDIR}"/defaults ] && . "${PM_UTILS_LIBDIR}"/defaults
+[ -f "${PM_UTILS_LIBDIR}"/defaults ] && . "${PM_UTILS_LIBDIR}"/defaults
 
-SLEEP_FUNCTIONS="${PM_UTILS_LIBDIR}/module.d/${SLEEP_MODULE}"
 set +a
 
-
 source_configs()
 {
 	for cfg in "${PM_UTILS_ETCDIR}"/config.d/*[!~] ; do
-		[ -O "$cfg" ] || continue
+		[ -f "$cfg" ] || continue
 		set -a
 		. "${cfg}"
 		set +a
@@ -47,6 +45,14 @@ source_configs()
 
 source_configs
 
+SLEEP_FUNCTIONS="${PM_UTILS_LIBDIR}/module.d/${SLEEP_MODULE}"
+[ -f "${SLEEP_FUNCTIONS}" ] || { 
+	echo "Requested sleep module $SLEEP_MODULE not available."
+	exit 1
+}
+
+. "${SLEEP_FUNCTIONS}"
+
 # try to take the lock.  Fail if we cannot get it.
 try_lock()
 {
@@ -165,13 +171,6 @@ get_power_status()
 	return $RETVAL
 }
 
-[ -O "${SLEEP_FUNCTIONS}" ] || { 
-	echo "Requested sleep module $SLEEP_MODULE not available."
-	exit 1
-}
-
-. "${SLEEP_FUNCTIONS}"
-
 init_logfile()
 {
 	if [ -h "$1" ]; then
-- 
1.5.4.1

_______________________________________________
Pm-utils mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pm-utils

Reply via email to