xref: /freebsd/contrib/pjdfstest/tests/open/24.t (revision 4928135658a9d0eaee37003df6137ab363fcb0b4)
1#!/bin/sh
2# vim: filetype=sh noexpandtab ts=8 sw=8
3# $FreeBSD: head/tools/regression/pjdfstest/tests/open/24.t 211352 2010-08-15 21:24:17Z pjd $
4
5dir=`dirname $0`
6. ${dir}/../misc.sh
7
8# POSIX doesn't explicitly state the errno for open(2)'ing sockets.
9case ${os} in
10Darwin|FreeBSD)
11	expected_error=EOPNOTSUPP
12	;;
13Linux)
14	expected_error=ENXIO
15	;;
16*)
17	echo "1..0 # SKIP: unsupported OS: ${os}"
18	exit 0
19	;;
20esac
21
22desc="open returns $expected_error when trying to open UNIX domain socket"
23
24echo "1..5"
25
26n0=`namegen`
27
28expect 0 bind ${n0}
29expect $expected_error open ${n0} O_RDONLY
30expect $expected_error open ${n0} O_WRONLY
31expect $expected_error open ${n0} O_RDWR
32expect 0 unlink ${n0}
33