xref: /openbsd/regress/sys/ffs/tests/open/11.t (revision ec7c50bf)
1*ec7c50bfSpedro#!/bin/sh
2*ec7c50bfSpedro# $FreeBSD: src/tools/regression/fstest/tests/open/11.t,v 1.1 2007/01/17 01:42:10 pjd Exp $
3*ec7c50bfSpedro
4*ec7c50bfSpedrodesc="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*ec7c50bfSpedro
6*ec7c50bfSpedron0=`namegen`
7*ec7c50bfSpedro
8*ec7c50bfSpedroexpect 0 create ${n0} 0644
9*ec7c50bfSpedroexpect 0 chflags ${n0} SF_APPEND
10*ec7c50bfSpedroexpect 0 open ${n0} O_WRONLY,O_APPEND
11*ec7c50bfSpedroexpect 0 open ${n0} O_RDWR,O_APPEND
12*ec7c50bfSpedroexpect EPERM open ${n0} O_WRONLY
13*ec7c50bfSpedroexpect EPERM open ${n0} O_RDWR
14*ec7c50bfSpedroexpect EPERM open ${n0} O_RDONLY,O_TRUNC
15*ec7c50bfSpedroexpect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
16*ec7c50bfSpedroexpect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
17*ec7c50bfSpedroexpect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
18*ec7c50bfSpedroexpect 0 chflags ${n0} none
19*ec7c50bfSpedroexpect 0 unlink ${n0}
20*ec7c50bfSpedro
21*ec7c50bfSpedroexpect 0 create ${n0} 0644
22*ec7c50bfSpedroexpect 0 chflags ${n0} UF_APPEND
23*ec7c50bfSpedroexpect 0 open ${n0} O_WRONLY,O_APPEND
24*ec7c50bfSpedroexpect 0 open ${n0} O_RDWR,O_APPEND
25*ec7c50bfSpedroexpect EPERM open ${n0} O_WRONLY
26*ec7c50bfSpedroexpect EPERM open ${n0} O_RDWR
27*ec7c50bfSpedroexpect EPERM open ${n0} O_RDONLY,O_TRUNC
28*ec7c50bfSpedroexpect EPERM open ${n0} O_RDONLY,O_APPEND,O_TRUNC
29*ec7c50bfSpedroexpect EPERM open ${n0} O_WRONLY,O_APPEND,O_TRUNC
30*ec7c50bfSpedroexpect EPERM open ${n0} O_RDWR,O_APPEND,O_TRUNC
31*ec7c50bfSpedroexpect 0 chflags ${n0} none
32*ec7c50bfSpedroexpect 0 unlink ${n0}
33