21547d78a1c7605417e0e65a8316be7748f9b356
[platform/upstream/coreutils.git] / tests / setgid-check
1 # -*- sh -*-
2 # Disable the current test if the working directory seems to have
3 # the setgid bit set.
4
5 # This test should be run in the temporary directory that ends
6 # up being removed via the trap commands.
7
8 cwd_is_setgid=no
9
10 setgid_tmpdir=setgid-$$
11 (umask 77; mkdir $setgid_tmpdir)
12 p=`ls -ld $setgid_tmpdir|sed 's/ .*//'`
13 rmdir $setgid_tmpdir
14 case $p in
15   drwx------);;
16   drwx------+);;
17   drwxr-xr-x);;  # Windows98 + DJGPP 2.03 + fileutils-4.1 does this.
18   *) cwd_is_setgid=yes;;
19 esac
20 if test $cwd_is_setgid = yes; then
21   cat <<EOF >&2
22 $0: Since it looks like you're running this test in a directory with
23 the setgid bit set, we're skipping this test.
24 EOF
25   (exit 77); exit 77
26 fi