xref: /openbsd/regress/sys/ffs/tests/open/15.t (revision 891d7ab6)
1#!/bin/sh
2# $FreeBSD: src/tools/regression/fstest/tests/open/15.t,v 1.1 2007/01/17 01:42:10 pjd Exp $
3
4desc="open returns EROFS when O_CREAT is specified and the named file would reside on a read-only file system"
5
6n0=`namegen`
7n1=`namegen`
8
9expect 0 mkdir ${n0} 0755
10dd if=/dev/zero of=tmpdisk bs=1k count=1024 2>/dev/null
11vnconfig vnd1 tmpdisk
12newfs /dev/rvnd1c >/dev/null
13mount /dev/vnd1c ${n0}
14expect 0 open ${n0}/${n1} O_RDONLY,O_CREAT 0644
15expect 0 unlink ${n0}/${n1}
16mount -ur /dev/vnd1c
17expect EROFS open ${n0}/${n1} O_RDONLY,O_CREAT 0644
18mount -uw /dev/vnd1c
19umount /dev/vnd1c
20vnconfig -u vnd1
21rm tmpdisk
22expect 0 rmdir ${n0}
23