xref: /openbsd-src/regress/sys/ffs/tests/chmod/11.t (revision ec7c50bfa3724241accbdcc8f761ed61061a0645)
1#!/bin/sh
2# $FreeBSD: src/tools/regression/fstest/tests/chmod/11.t,v 1.1 2007/01/17 01:42:08 pjd Exp $
3
4desc="chmod returns EFTYPE if the effective user ID is not the super-user, the mode includes the sticky bit (S_ISVTX), and path does not refer to a directory"
5
6n0=`namegen`
7n1=`namegen`
8
9expect 0 mkdir ${n0} 0755
10cdir=`pwd`
11cd ${n0}
12
13expect 0 mkdir ${n1} 0755
14expect 0 chmod ${n1} 01755
15expect 01755 stat ${n1} mode
16expect 0 rmdir ${n1}
17
18expect 0 create ${n1} 0644
19expect 0 chmod ${n1} 01644
20expect 01644 stat ${n1} mode
21expect 0 unlink ${n1}
22
23expect 0 mkdir ${n1} 0755
24expect 0 chown ${n1} 65534 65534
25expect 0 -u 65534 -g 65534 chmod ${n1} 01755
26expect 01755 stat ${n1} mode
27expect 0 rmdir ${n1}
28
29expect 0 create ${n1} 0644
30expect 0 chown ${n1} 65534 65534
31expect EFTYPE -u 65534 -g 65534 chmod ${n1} 01644
32expect 0644 stat ${n1} mode
33expect 0 unlink ${n1}
34
35cd ${cdir}
36expect 0 rmdir ${n0}
37