- 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.ra...@linaro.org>
---
 include/suspend_functions.sh | 8 +++++---
 1 file 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.zh...@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.
-- 
1.8.3.2


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to