1#!/bin/sh 2# $FreeBSD: head/tools/regression/pjdfstest/tests/open/10.t 211352 2010-08-15 21:24:17Z pjd $ 3 4desc="open returns EPERM when the named file has its immutable flag set and the file is to be modified" 5 6dir=`dirname $0` 7. ${dir}/../misc.sh 8 9require chflags 10 11case "${os}:${fs}" in 12FreeBSD:ZFS) 13 echo "1..14" 14 ;; 15FreeBSD:UFS) 16 echo "1..28" 17 ;; 18*) 19 quick_exit 20esac 21 22n0=`namegen` 23 24expect 0 create ${n0} 0644 25expect 0 chflags ${n0} SF_IMMUTABLE 26expect EPERM open ${n0} O_WRONLY 27expect EPERM open ${n0} O_RDWR 28expect EPERM open ${n0} O_RDONLY,O_TRUNC 29expect 0 chflags ${n0} none 30expect 0 unlink ${n0} 31 32expect 0 create ${n0} 0644 33expect 0 chflags ${n0} SF_NOUNLINK 34expect 0 open ${n0} O_WRONLY 35expect 0 open ${n0} O_RDWR 36expect 0 open ${n0} O_RDONLY,O_TRUNC 37expect 0 chflags ${n0} none 38expect 0 unlink ${n0} 39 40case "${os}:${fs}" in 41FreeBSD:UFS) 42 expect 0 create ${n0} 0644 43 expect 0 chflags ${n0} UF_IMMUTABLE 44 expect EPERM open ${n0} O_WRONLY 45 expect EPERM open ${n0} O_RDWR 46 expect EPERM open ${n0} O_RDONLY,O_TRUNC 47 expect 0 chflags ${n0} none 48 expect 0 unlink ${n0} 49 50 expect 0 create ${n0} 0644 51 expect 0 chflags ${n0} UF_NOUNLINK 52 expect 0 open ${n0} O_WRONLY 53 expect 0 open ${n0} O_RDWR 54 expect 0 open ${n0} O_RDONLY,O_TRUNC 55 expect 0 chflags ${n0} none 56 expect 0 unlink ${n0} 57 ;; 58esac 59