xref: /freebsd/contrib/pjdfstest/tests/link/03.t (revision 39ee7a7a6bdd1557b1c3532abf60d139798ac88b)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/link/03.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="link returns ENAMETOOLONG if an entire length of either path name exceeded {PATH_MAX} characters"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..13"
10
11n0=`namegen`
12nx=`dirgen_max`
13nxx="${nx}x"
14
15mkdir -p "${nx%/*}"
16
17expect 0 create ${nx} 0644
18expect 0 link ${nx} ${n0}
19expect 2 stat ${n0} nlink
20expect 2 stat ${nx} nlink
21expect 0 unlink ${nx}
22expect 0 link ${n0} ${nx}
23expect 2 stat ${n0} nlink
24expect 2 stat ${nx} nlink
25expect 0 unlink ${nx}
26expect ENAMETOOLONG link ${n0} ${nxx}
27expect 1 stat ${n0} nlink
28expect 0 unlink ${n0}
29expect ENAMETOOLONG link ${nxx} ${n0}
30
31rm -rf "${nx%%/*}"
32