xref: /freebsd/contrib/pjdfstest/tests/open/16.t (revision 451bcf1b360146af0759ac18c9cc55f0a36cc386)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/open/16.t 219621 2011-03-13 19:35:13Z pjd $
4
5dir=`dirname $0`
6. ${dir}/../misc.sh
7
8case "${os}" in
9Darwin|Linux)
10	error=ELOOP
11	;;
12*)
13	error=EMLINK
14	;;
15esac
16desc="open returns $error when O_NOFOLLOW was specified and the target is a symbolic link"
17
18echo "1..6"
19
20n0=`namegen`
21n1=`namegen`
22
23expect 0 symlink ${n0} ${n1}
24expect $error open ${n1} O_RDONLY,O_CREAT,O_NOFOLLOW 0644
25expect $error open ${n1} O_RDONLY,O_NOFOLLOW
26expect $error open ${n1} O_WRONLY,O_NOFOLLOW
27expect $error open ${n1} O_RDWR,O_NOFOLLOW
28expect 0 unlink ${n1}
29