10.t revision 210984
1166065Spjd#!/bin/sh 2166065Spjd# $FreeBSD: head/tools/regression/fstest/tests/open/10.t 210984 2010-08-06 23:58:54Z pjd $ 3166065Spjd 4166065Spjddesc="open returns EPERM when the named file has its immutable flag set and the file is to be modified" 5166065Spjd 6166065Spjddir=`dirname $0` 7166065Spjd. ${dir}/../misc.sh 8166065Spjd 9166065Spjdrequire chflags 10166065Spjd 11210984Spjdcase "${os}:${fs}" in 12210984SpjdFreeBSD:ZFS) 13210984Spjd echo "1..14" 14210984Spjd ;; 15210984SpjdFreeBSD:UFS) 16210984Spjd echo "1..28" 17210984Spjd ;; 18210984Spjd*) 19210984Spjd quick_exit 20210984Spjdesac 21166065Spjd 22166065Spjdn0=`namegen` 23166065Spjd 24166065Spjdexpect 0 create ${n0} 0644 25166065Spjdexpect 0 chflags ${n0} SF_IMMUTABLE 26166065Spjdexpect EPERM open ${n0} O_WRONLY 27166065Spjdexpect EPERM open ${n0} O_RDWR 28166065Spjdexpect EPERM open ${n0} O_RDONLY,O_TRUNC 29166065Spjdexpect 0 chflags ${n0} none 30166065Spjdexpect 0 unlink ${n0} 31166065Spjd 32166065Spjdexpect 0 create ${n0} 0644 33166065Spjdexpect 0 chflags ${n0} SF_NOUNLINK 34166065Spjdexpect 0 open ${n0} O_WRONLY 35166065Spjdexpect 0 open ${n0} O_RDWR 36166065Spjdexpect 0 open ${n0} O_RDONLY,O_TRUNC 37166065Spjdexpect 0 chflags ${n0} none 38166065Spjdexpect 0 unlink ${n0} 39166065Spjd 40210984Spjdcase "${os}:${fs}" in 41210984SpjdFreeBSD:UFS) 42210984Spjd expect 0 create ${n0} 0644 43210984Spjd expect 0 chflags ${n0} UF_IMMUTABLE 44210984Spjd expect EPERM open ${n0} O_WRONLY 45210984Spjd expect EPERM open ${n0} O_RDWR 46210984Spjd expect EPERM open ${n0} O_RDONLY,O_TRUNC 47210984Spjd expect 0 chflags ${n0} none 48210984Spjd expect 0 unlink ${n0} 49210984Spjd 50210984Spjd expect 0 create ${n0} 0644 51210984Spjd expect 0 chflags ${n0} UF_NOUNLINK 52210984Spjd expect 0 open ${n0} O_WRONLY 53210984Spjd expect 0 open ${n0} O_RDWR 54210984Spjd expect 0 open ${n0} O_RDONLY,O_TRUNC 55210984Spjd expect 0 chflags ${n0} none 56210984Spjd expect 0 unlink ${n0} 57210984Spjd ;; 58210984Spjdesac 59