summaryrefslogtreecommitdiff
path: root/tests/id/context.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/id/context.sh')
-rwxr-xr-xtests/id/context.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/id/context.sh b/tests/id/context.sh
index 754d0c3ba..b1aefe73f 100755
--- a/tests/id/context.sh
+++ b/tests/id/context.sh
@@ -26,7 +26,10 @@ id | grep context= >/dev/null || fail=1
# Check with specified user, no context string should be present.
# But if the current user is nameless, skip this part.
-id -nu > /dev/null \
- && id $(id -nu) | grep context= >/dev/null && fail=1
+name=$(id -nu) || { test $? -ne 1 && fail=1; }
+if test "$name"; then
+ id "$name" > id_name || fail=1
+ grep context= id_name >/dev/null && fail=1
+fi
Exit $fail