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