summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2010-10-11 23:24:57 +0000
committerobrien <obrien@FreeBSD.org>2010-10-11 23:24:57 +0000
commit5d3cd8d3f07a0534fb7bee6f952bb2c1a7978ce6 (patch)
tree7dcf12f951dcacdb4a343f8b88a9dbef128dbbd5 /tools
parent6062a8438fe70565b3ea72eece54cedaf154883d (diff)
downloadFreeBSD-src-5d3cd8d3f07a0534fb7bee6f952bb2c1a7978ce6.zip
FreeBSD-src-5d3cd8d3f07a0534fb7bee6f952bb2c1a7978ce6.tar.gz
Correct regression test to not show a false positive when run as root.
Diffstat (limited to 'tools')
-rw-r--r--tools/regression/bin/sh/builtins/cd1.015
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/regression/bin/sh/builtins/cd1.0 b/tools/regression/bin/sh/builtins/cd1.0
index b615174..8c69536 100644
--- a/tools/regression/bin/sh/builtins/cd1.0
+++ b/tools/regression/bin/sh/builtins/cd1.0
@@ -6,12 +6,15 @@ cd $P
T=$(mktemp -d sh-test.XXXXXX)
chmod 0 $T
-cd -L $T 2>/dev/null && exit 1
-[ "$PWD" = "$P" ]
-[ "$(pwd)" = "$P" ]
-cd -P $T 2>/dev/null && exit 1
-[ "$PWD" = "$P" ]
-[ "$(pwd)" = "$P" ]
+if [ `id -u` -ne 0 ]; then
+ # Root can always cd, irregardless of directory permissions.
+ cd -L $T 2>/dev/null && exit 1
+ [ "$PWD" = "$P" ]
+ [ "$(pwd)" = "$P" ]
+ cd -P $T 2>/dev/null && exit 1
+ [ "$PWD" = "$P" ]
+ [ "$(pwd)" = "$P" ]
+fi
chmod 755 $T
cd $T
OpenPOWER on IntegriCloud