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