Deleted Added
full compact
22.t (211156) 22.t (211186)
1#!/bin/sh
1#!/bin/sh
2# $FreeBSD: head/tools/regression/fstest/tests/open/22.t 211156 2010-08-10 22:57:43Z pjd $
2# $FreeBSD: head/tools/regression/fstest/tests/open/22.t 211186 2010-08-11 17:34:58Z pjd $
3
4desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file exists"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..21"
10
11n0=`namegen`
12
3
4desc="open returns EEXIST when O_CREAT and O_EXCL were specified and the file exists"
5
6dir=`dirname $0`
7. ${dir}/../misc.sh
8
9echo "1..21"
10
11n0=`namegen`
12
13expect 0 create ${n0} 0644
14expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
15expect 0 unlink ${n0}
16
17expect 0 mkdir ${n0} 0755
18expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
19expect 0 rmdir ${n0}
20
21expect 0 mkfifo ${n0} 0644
22expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
23expect 0 unlink ${n0}
24
25expect 0 symlink test ${n0}
26expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
27expect 0 unlink ${n0}
28
29expect 0 mknod ${n0} b 0644 1 2
30expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
31expect 0 unlink ${n0}
32
33expect 0 mknod ${n0} c 0644 1 2
34expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
35expect 0 unlink ${n0}
36
37expect 0 bind ${n0}
38expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
39expect 0 unlink ${n0}
13for type in regular dir fifo block char socket symlink; do
14 create_file ${type} ${n0}
15 expect EEXIST open ${n0} O_CREAT,O_EXCL 0644
16 if [ "${type}" = "dir" ]; then
17 expect 0 rmdir ${n0}
18 else
19 expect 0 unlink ${n0}
20 fi
21done