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