From patchwork Wed Jul 30 09:02:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 34505 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29FCF20DCC for ; Wed, 30 Jul 2014 09:03:22 +0000 (UTC) Received: by mail-oi0-f69.google.com with SMTP id h136sf4349947oig.4 for ; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=U4c5mE0W7TIrTciKCgQf30zBQ5R9rHTldqk6L4CN91Y=; b=SsPQcUQVhgyoaqgtIXVIkWnPtZPijwPXs7SNEcTOkxvnoRCp2EvWzWGZRPIx1oU4Tf drzkRc9SLeOLXT9x/YOD/c4LOoTFrYL1G+G+MZd49bMlOTdNM6osUaxeJEQVl6VPy4Bc s61ZqS1CEzQ8bqllNoFkHdS/061z0xWsUr/dN2OBN2TLs/79ijQ41swqqgUQeU3GesiS uQM1xh5D7YDoN/XAh4IjcKFPZLg7AcIgEQqaCEKXnaeYnl00Ji2Wkzl90SLVdNvGMPcV l2dHOVOgBEJnGfTAMSrtKPwHHYlLq3o2FncWuKqx/GJGKi+AA8s3fY1IAmj0HJtjy7rn LJwg== X-Gm-Message-State: ALoCoQnogNNRsu/BMYoEjt8w1QOCrmWSKZz9wIMbKfkq99AOEVEABmVZ+ZDz7oE81yg7nDg7GWSe X-Received: by 10.182.45.197 with SMTP id p5mr1240167obm.2.1406711001433; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.36 with SMTP id b33ls463098qgd.68.gmail; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) X-Received: by 10.52.241.43 with SMTP id wf11mr100832vdc.97.1406711001324; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id u3si1095859vey.74.2014.07.30.02.03.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 02:03:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so1296465vcb.4 for ; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr6046570vdb.25.1406711001202; Wed, 30 Jul 2014 02:03:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp11744vcb; Wed, 30 Jul 2014 02:03:20 -0700 (PDT) X-Received: by 10.70.48.42 with SMTP id i10mr2842948pdn.129.1406711000454; Wed, 30 Jul 2014 02:03:20 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id gx11si1670207pbd.66.2014.07.30.02.03.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 02:03:20 -0700 (PDT) Received-SPF: pass (google.com: domain of sanjay.rawat@linaro.org designates 209.85.220.53 as permitted sender) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id rd3so1162819pab.26 for ; Wed, 30 Jul 2014 02:03:19 -0700 (PDT) X-Received: by 10.68.253.73 with SMTP id zy9mr3014206pbc.114.1406710999779; Wed, 30 Jul 2014 02:03:19 -0700 (PDT) Received: from ubuntu5e03.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id et1sm1607857pbc.39.2014.07.30.02.03.16 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 02:03:18 -0700 (PDT) From: Sanjay Singh Rawat To: linaro-dev@lists.linaro.org Cc: Sanjay Singh Rawat Subject: [PATCH PMQA] suspend: use generic function to check root user Date: Wed, 30 Jul 2014 14:32:28 +0530 Message-Id: <1406710948-13046-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , - 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 --- 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.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.