xref: /freebsd/contrib/pjdfstest/tests/truncate/05.t (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/truncate/05.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="truncate returns EACCES when search permission is denied for a component of the path prefix"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..15"
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 0 -u 65534 -g 65534 truncate ${n1}/${n2} 123
22expect 123 -u 65534 -g 65534 stat ${n1}/${n2} size
23expect 0 chmod ${n1} 0644
24expect EACCES -u 65534 -g 65534 truncate ${n1}/${n2} 1234
25expect 0 chmod ${n1} 0755
26expect 123 -u 65534 -g 65534 stat ${n1}/${n2} size
27expect 0 -u 65534 -g 65534 truncate ${n1}/${n2} 1234
28expect 1234 -u 65534 -g 65534 stat ${n1}/${n2} size
29expect 0 -u 65534 -g 65534 unlink ${n1}/${n2}
30expect 0 rmdir ${n1}
31cd ${cdir}
32expect 0 rmdir ${n0}
33