xref: /freebsd/contrib/pjdfstest/tests/link/10.t (revision 7431dfd4580e850375fe5478d92ec770344db098)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/10.t 211474 2010-08-18 22:06:43Z pjd $
3
4desc="link returns EEXIST if the destination file does exist"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..23"
10
11n0=`namegen`
12n1=`namegen`
13
14expect 0 create ${n0} 0644
15
16for type in regular dir fifo block char socket symlink; do
17	create_file ${type} ${n1}
18	expect EEXIST link ${n0} ${n1}
19	if [ "${type}" = "dir" ]; then
20		expect 0 rmdir ${n1}
21	else
22		expect 0 unlink ${n1}
23	fi
24done
25
26expect 0 unlink ${n0}
27