xref: /freebsd/contrib/pjdfstest/tests/link/07.t (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/07.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="link returns EACCES when the requested link requires writing in a directory with a mode that denies write permission"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..17"
10
11n0=`namegen`
12n1=`namegen`
13n2=`namegen`
14n3=`namegen`
15n4=`namegen`
16
17expect 0 mkdir ${n0} 0755
18cdir=`pwd`
19cd ${n0}
20
21expect 0 mkdir ${n1} 0755
22expect 0 chown ${n1} 65534 65534
23expect 0 mkdir ${n2} 0755
24expect 0 chown ${n2} 65534 65534
25expect 0 -u 65534 -g 65534 create ${n1}/${n3} 0644
26
27expect 0 -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
28expect 0 -u 65534 -g 65534 unlink ${n2}/${n4}
29
30expect 0 chmod ${n2} 0555
31expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n2}/${n4}
32expect 0 chmod ${n1} 0555
33expect EACCES -u 65534 -g 65534 link ${n1}/${n3} ${n1}/${n4}
34expect 0 chmod ${n1} 0755
35
36expect 0 unlink ${n1}/${n3}
37expect 0 rmdir ${n1}
38expect 0 rmdir ${n2}
39
40cd ${cdir}
41expect 0 rmdir ${n0}
42