aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-07-30 14:32:28 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-08-04 14:45:53 +0530
commitb607f9353cd9c44046351dba2636b7d87f146190 (patch)
tree49d752ca1a1cf7b1e3c513b330f5b350a14a6c9b
parent01a028695beac5b194c01084aedbf94e0d0a1f62 (diff)
suspend: use generic function to check root user
- command (id) to check root user returns different output format for ubuntu and android. Using generic function to avoid build errors. - bug 166 Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
-rw-r--r--include/suspend_functions.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/suspend_functions.sh b/include/suspend_functions.sh
index 1e8a793..3be29f5 100644
--- a/include/suspend_functions.sh
+++ b/include/suspend_functions.sh
@@ -33,6 +33,7 @@
# - hongbo.zhang@linaro.org, March, 2012
#
+source ./functions.sh
LOGDIR='/var/lib/pm-utils'
LOGFILE="$LOGDIR/stress.log"
@@ -44,9 +45,10 @@ pm_trace=1
timer_sleep=20
# root is needed to fiddle with the clock and use the rtc wakeups.
-if [ $(id -u) -ne 0 ]; then
- log_skip "run as non-root"
- exit 0
+is_root
+if [ $? -ne 0 ]; then
+ log_skip "user is not root"
+ exit 0
fi
# Ensure the log directory exists.