xref: /freebsd/contrib/pjdfstest/tests/link/11.t (revision b9f654b163bce26de79705e77b872427c9f2afa1)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/link/11.t 211352 2010-08-15 21:24:17Z pjd $
4
5desc="link returns EPERM if the source file is a directory"
6
7dir=`dirname $0`
8. ${dir}/../misc.sh
9
10n0=`namegen`
11n1=`namegen`
12n2=`namegen`
13
14case "${os}:${fs}" in
15SunOS:UFS)
16	echo "1..10"
17
18	expect 0 mkdir ${n0} 0755
19	expect 0 link ${n0} ${n1}
20	expect 0 unlink ${n1}
21	expect 0 rmdir ${n0}
22	;;
23*)
24	echo "1..9"
25
26	expect 0 mkdir ${n0} 0755
27	expect EPERM link ${n0} ${n1}
28	expect 0 rmdir ${n0}
29	;;
30esac
31
32expect 0 mkdir ${n0} 0755
33expect 0 chown ${n0} 65534 65534
34cdir=`pwd`
35cd ${n0}
36
37expect 0 -u 65534 -g 65534 mkdir ${n1} 0755
38expect EPERM -u 65534 -g 65534 link ${n1} ${n2}
39expect 0 -u 65534 -g 65534 rmdir ${n1}
40
41cd ${cdir}
42expect 0 rmdir ${n0}
43