diff options
author | Lisa Nguyen <lisa.nguyen@linaro.org> | 2015-11-06 19:34:38 -0800 |
---|---|---|
committer | Lisa Nguyen <lisa.nguyen@linaro.org> | 2015-11-18 13:32:24 -0800 |
commit | 46f76f8a05bcf02dcadf3b38de2cd45295227d79 (patch) | |
tree | bce3db5881645cd0645c9a38e8c31d6179c2e1ea | |
parent | 1b8a39c5d443feffe4c34cf15b1b21ea0b957bf0 (diff) | |
download | pm-qa-46f76f8a05bcf02dcadf3b38de2cd45295227d79.tar.gz |
functions: Edit regex for is_root() function
The regex for the is_root() needs to be updated to
extract the user ID number properly.
Otherwise, errors such as this one will come up:
cpuhotplug_sanity.sh[28]: 0(root): bad number
This patch would fix bug #1889:
https://bugs.linaro.org/show_bug.cgi?id=1889
Signed-off-by: Lisa Nguyen <lisa.nguyen@linaro.org>
-rw-r--r-- | include/functions.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/functions.sh b/include/functions.sh index bb71302..ab73e4a 100644 --- a/include/functions.sh +++ b/include/functions.sh @@ -408,7 +408,7 @@ is_root() { ret=$(id -u) else # for android - ret=$(id | sed -n 's/uid=//p' | sed -n 's/(root) [a-z]*=[0-9]*(log)//p') + ret=$(id | awk '{if ($1) print $1}' | sed 's/[^0-9]*//g') fi return $ret } |