xref: /freebsd/contrib/pjdfstest/tests/truncate/06.t (revision fed1ca4b719c56c930f2259d80663cd34be812bb)
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