xref: /openbsd/regress/sys/ffs/tests/chmod/08.t (revision ba194976)
1#!/bin/sh
2# $FreeBSD: src/tools/regression/fstest/tests/chmod/08.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
3
4desc="chmod returns EPERM if the named file has its immutable or append-only flag set"
5
6n0=`namegen`
7
8expect 0 create ${n0} 0644
9expect 0 chflags ${n0} SF_IMMUTABLE
10expect EPERM chmod ${n0} 0600
11expect 0644 stat ${n0} mode
12expect 0 chflags ${n0} none
13expect 0 chmod ${n0} 0600
14expect 0 unlink ${n0}
15
16expect 0 create ${n0} 0644
17expect 0 chflags ${n0} UF_IMMUTABLE
18expect EPERM chmod ${n0} 0600
19expect 0644 stat ${n0} mode
20expect 0 chflags ${n0} none
21expect 0 chmod ${n0} 0600
22expect 0 unlink ${n0}
23
24expect 0 create ${n0} 0644
25expect 0 chflags ${n0} SF_APPEND
26expect EPERM chmod ${n0} 0600
27expect 0644 stat ${n0} mode
28expect 0 chflags ${n0} none
29expect 0 chmod ${n0} 0600
30expect 0 unlink ${n0}
31
32expect 0 create ${n0} 0644
33expect 0 chflags ${n0} UF_APPEND
34expect EPERM chmod ${n0} 0600
35expect 0644 stat ${n0} mode
36expect 0 chflags ${n0} none
37expect 0 chmod ${n0} 0600
38expect 0 unlink ${n0}
39