xref: /freebsd/contrib/pjdfstest/tests/truncate/06.t (revision 09a53ad8f1318c5daae6cfb19d97f4f6459f0013)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/06.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="truncate returns EACCES if the named file is not writable by the user"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..8"
10
11n0=`namegen`
12n1=`namegen`
13
14expect 0 mkdir ${n0} 0755
15cdir=`pwd`
16cd ${n0}
17expect 0 create ${n1} 0644
18expect EACCES -u 65534 -g 65534 truncate ${n1} 123
19expect 0 chown ${n1} 65534 65534
20expect 0 chmod ${n1} 0444
21expect EACCES -u 65534 -g 65534 truncate ${n1} 123
22expect 0 unlink ${n1}
23cd ${cdir}
24expect 0 rmdir ${n0}
25