1#!/bin/sh
2# $FreeBSD: src/tools/regression/fstest/tests/open/19.t,v 1.1 2007/01/17 01:42:10 pjd Exp $
3
4desc="open returns ENOSPC when O_CREAT is specified, the file does not exist, and there are no free inodes on the file system on which the file is being created"
5
6n0=`namegen`
7n1=`namegen`
8
9expect 0 mkdir ${n0} 0755
10dd if=/dev/zero of=tmpdisk bs=1k count=256 status=none
11vnconfig vnd1 tmpdisk
12newfs /dev/rvnd1c >/dev/null
13mount /dev/vnd1c ${n0}
14i=0
15while :; do
16	touch ${n0}/${i} 2>/dev/null
17	if [ $? -ne 0 ]; then
18		break
19	fi
20	i=$((i + 1))
21done
22expect ENOSPC open ${n0}/${i} O_RDONLY,O_CREAT 0644
23umount /dev/vnd1c
24vnconfig -u vnd1
25rm tmpdisk
26expect 0 rmdir ${n0}
27