diff options
author | Sanjay Singh Rawat <sanjay.rawat@linaro.org> | 2014-07-30 14:32:28 +0530 |
---|---|---|
committer | Lisa Nguyen <lisa.nguyen@linaro.org> | 2014-08-18 21:57:14 -0700 |
commit | 6c2419a3030c26ca1002900c1f98cf0fdca22841 (patch) | |
tree | 49d752ca1a1cf7b1e3c513b330f5b350a14a6c9b | |
parent | 7fa198e218e9d2c0a6ae3fc735fdff0b2b2f02e3 (diff) | |
download | pm-qa-6c2419a3030c26ca1002900c1f98cf0fdca22841.tar.gz |
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.sh | 8 |
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. |