summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpm/functions10
-rwxr-xr-xsrc/pm-powersave2
2 files changed, 9 insertions, 3 deletions
diff --git a/pm/functions b/pm/functions
index dcf1131..6282498 100755
--- a/pm/functions
+++ b/pm/functions
@@ -174,11 +174,15 @@ do_suspend_hybrid()
return 1
}
+init_logfile() {
+ if [ -n "$1" ]; then
+ exec > "$1" 2>&1
+ fi
+}
+
pm_main()
{
- if [ -n "$PM_LOGFILE" ]; then
- exec > "$PM_LOGFILE" 2>&1
- fi
+ init_logfile "$PM_LOGFILE"
take_suspend_lock || exit 1
# make sure that our locks are unlocked no matter how the script exits
diff --git a/src/pm-powersave b/src/pm-powersave
index 84acbaf..11ec1b9 100755
--- a/src/pm-powersave
+++ b/src/pm-powersave
@@ -24,10 +24,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+POWERSAVE_LOGFILE="/dev/null"
[ -f /usr/lib/pm-utils/functions ] || return 1
. /usr/lib/pm-utils/functions
if [ "x$1" = "xtrue" -o "x$1" = "xfalse" ] ; then
+ init_logfile "${POWERSAVE_LOGFILE}"
run_hooks power "$1"
else
echo "Argument needs to be true or false" >&2