1#!/bin/sh
2# $FreeBSD: releng/10.2/tools/regression/pjdfstest/tests/link/15.t 210984 2010-08-06 23:58:54Z pjd $
3
4desc="link returns ENOSPC if the directory in which the entry for the new link is being placed cannot be extended because there is no space left on the file system containing the directory"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..4"
12
13n0=`namegen`
14n1=`namegen`
15n2=`namegen`
16
17expect 0 mkdir ${n0} 0755
18n=`mdconfig -a -n -t malloc -s 256k`
19newfs /dev/md${n} >/dev/null
20mount /dev/md${n} ${n0}
21expect 0 create ${n0}/${n1} 0644
22i=0
23while :; do
24	link ${n0}/${n1} ${n0}/${i} >/dev/null 2>&1
25	if [ $? -ne 0 ]; then
26		break
27	fi
28	i=`expr $i + 1`
29done
30expect ENOSPC link ${n0}/${n1} ${n0}/${n2}
31umount /dev/md${n}
32mdconfig -d -u ${n}
33expect 0 rmdir ${n0}
34