2 # $FreeBSD: head/tools/regression/pjdfstest/tests/chflags/11.t 211352 2010-08-15 21:24:17Z pjd $
4 desc="chflags returns EPERM if a user tries to set or remove the SF_SNAPSHOT flag"
9 require chflags_SF_SNAPSHOT
17 expect 0 mkdir ${n0} 0755
21 for type in regular dir fifo block char socket symlink; do
22 if [ "${type}" != "symlink" ]; then
23 create_file ${type} ${n1}
24 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
25 expect none stat ${n1} flags
26 expect EPERM chflags ${n1} SF_SNAPSHOT
27 expect none stat ${n1} flags
28 expect 0 chown ${n1} 65534 65534
29 expect EPERM -u 65534 -g 65534 chflags ${n1} SF_SNAPSHOT
30 expect none stat ${n1} flags
31 expect EPERM chflags ${n1} SF_SNAPSHOT
32 expect none stat ${n1} flags
33 if [ "${type}" = "dir" ]; then
40 create_file ${type} ${n1}
41 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
42 expect none lstat ${n1} flags
43 expect EPERM lchflags ${n1} SF_SNAPSHOT
44 expect none lstat ${n1} flags
45 expect 0 lchown ${n1} 65534 65534
46 expect EPERM -u 65534 -g 65534 lchflags ${n1} SF_SNAPSHOT
47 expect none lstat ${n1} flags
48 expect EPERM lchflags ${n1} SF_SNAPSHOT
49 expect none lstat ${n1} flags
50 if [ "${type}" = "dir" ]; then