xref: /freebsd/contrib/pjdfstest/tests/open/20.t (revision 596596fec79f04e1f413850b44159224ff1fb8dc)
1#!/bin/sh
2# $FreeBSD: head/tools/regression/pjdfstest/tests/open/20.t 211352 2010-08-15 21:24:17Z pjd $
3
4desc="open returns ETXTBSY when the file is a pure procedure (shared text) file that is being executed and the open() system call requests write access"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9[ "${os}:${fs}" = "FreeBSD:UFS" ] || quick_exit
10
11echo "1..4"
12
13n0=`namegen`
14
15cp -pf `which sleep` ${n0}
16./${n0} 3 &
17expect ETXTBSY open ${n0} O_WRONLY
18expect ETXTBSY open ${n0} O_RDWR
19expect ETXTBSY open ${n0} O_RDONLY,O_TRUNC
20expect 0 unlink ${n0}
21