06.t revision 271294
133965Sjdp#!/bin/sh
2130561Sobrien# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/06.t 211352 2010-08-15 21:24:17Z pjd $
333965Sjdp
433965Sjdpdesc="truncate returns EACCES if the named file is not writable by the user"
533965Sjdp
633965Sjdpdir=`dirname $0`
733965Sjdp. ${dir}/../misc.sh
833965Sjdp
933965Sjdpecho "1..8"
1033965Sjdp
1133965Sjdpn0=`namegen`
1233965Sjdpn1=`namegen`
1333965Sjdp
1433965Sjdpexpect 0 mkdir ${n0} 0755
1533965Sjdpcdir=`pwd`
1633965Sjdpcd ${n0}
1733965Sjdpexpect 0 create ${n1} 0644
1833965Sjdpexpect EACCES -u 65534 -g 65534 truncate ${n1} 123
19218822Sdimexpect 0 chown ${n1} 65534 65534
20218822Sdimexpect 0 chmod ${n1} 0444
2133965Sjdpexpect EACCES -u 65534 -g 65534 truncate ${n1} 123
2233965Sjdpexpect 0 unlink ${n1}
2333965Sjdpcd ${cdir}
2433965Sjdpexpect 0 rmdir ${n0}
2533965Sjdp