]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/pjdfstest/tests/mknod/09.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / pjdfstest / tests / mknod / 09.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 desc="mknod returns EPERM if the parent directory of the file to be created has its immutable flag set"
5
6 dir=`dirname $0`
7 . ${dir}/../misc.sh
8
9 require chflags
10
11 case "${os}:${fs}" in
12 FreeBSD:UFS)
13         echo "1..30"
14         ;;
15 *)
16         echo "1..17"
17         ;;
18 esac
19
20 n0=`namegen`
21 n1=`namegen`
22
23 expect 0 mkdir ${n0} 0755
24
25 expect 0 mknod ${n0}/${n1} f 0644 0 0
26 expect 0 unlink ${n0}/${n1}
27
28 expect 0 chflags ${n0} SF_IMMUTABLE
29 expect EPERM mknod ${n0}/${n1} f 0644 0 0
30 expect 0 chflags ${n0} none
31 expect 0 mknod ${n0}/${n1} f 0644 0 0
32 expect 0 unlink ${n0}/${n1}
33
34 expect 0 chflags ${n0} SF_APPEND
35 expect 0 mknod ${n0}/${n1} f 0644 0 0
36 expect 0 chflags ${n0} none
37 expect 0 unlink ${n0}/${n1}
38
39 expect 0 chflags ${n0} SF_NOUNLINK
40 expect 0 mknod ${n0}/${n1} f 0644 0 0
41 expect 0 unlink ${n0}/${n1}
42 expect 0 chflags ${n0} none
43
44 case "${os}:${fs}" in
45 FreeBSD:UFS)
46         expect 0 chflags ${n0} UF_IMMUTABLE
47         expect EPERM mknod ${n0}/${n1} f 0644 0 0
48         expect 0 chflags ${n0} none
49         expect 0 mknod ${n0}/${n1} f 0644 0 0
50         expect 0 unlink ${n0}/${n1}
51
52         expect 0 chflags ${n0} UF_APPEND
53         expect 0 mknod ${n0}/${n1} f 0644 0 0
54         expect 0 chflags ${n0} none
55         expect 0 unlink ${n0}/${n1}
56
57         expect 0 chflags ${n0} UF_NOUNLINK
58         expect 0 mknod ${n0}/${n1} f 0644 0 0
59         expect 0 unlink ${n0}/${n1}
60         expect 0 chflags ${n0} none
61         ;;
62 esac
63
64 expect 0 rmdir ${n0}