07.t revision 166065
1#!/bin/sh
2# $FreeBSD: head/tools/regression/fstest/tests/chown/07.t 166065 2007-01-17 01:42:12Z pjd $
3
4desc="chown returns EPERM if the operation would change the ownership, but the effective user ID is not the super-user and the process is not an owner of the file"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..11"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14
15expect 0 mkdir ${n0} 0755
16cdir=`pwd`
17cd ${n0}
18expect 0 mkdir ${n1} 0755
19expect 0 chown ${n1} 65534 65534
20expect 0 -u 65534 -g 65534 create ${n1}/${n2} 0644
21expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} 65533 65533
22expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65534 65534
23expect EPERM -u 65533 -g 65533 chown ${n1}/${n2} 65533 65533
24expect EPERM -u 65534 -g 65534 chown ${n1}/${n2} -1 65533
25expect 0 unlink ${n1}/${n2}
26expect 0 rmdir ${n1}
27cd ${cdir}
28expect 0 rmdir ${n0}
29