diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2011-03-08 01:16:32 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2011-03-08 01:16:32 +0000 |
commit | dc04aa385c7e2cc16f26fe1495c1a3ea54adf719 (patch) | |
tree | 7ce191182404108b398bfec580c0967bff116c98 /regress/sys | |
parent | 488c14dc7c744c2390691f754bdf25040049f583 (diff) |
Add regression test that checks ENOTSOCK error for non-socket drain.
Diffstat (limited to 'regress/sys')
-rwxr-xr-x | regress/sys/kern/splice/error-splice-ENOTSOCK.pl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/regress/sys/kern/splice/error-splice-ENOTSOCK.pl b/regress/sys/kern/splice/error-splice-ENOTSOCK.pl new file mode 100755 index 00000000000..228536efafb --- /dev/null +++ b/regress/sys/kern/splice/error-splice-ENOTSOCK.pl @@ -0,0 +1,23 @@ +#!/usr/bin/perl +# test ENOTSOCK for splicing with non-socket + +use Errno; +use IO::Socket; +use constant SO_SPLICE => 0x1023; + +my $sl = IO::Socket::INET->new( + Proto => "tcp", + Listen => 5, + LocalAddr => "127.0.0.1", +) or die "socket listen failed: $!"; + +my $s = IO::Socket::INET->new( + Proto => "tcp", + PeerAddr => $sl->sockhost(), + PeerPort => $sl->sockport(), +) or die "socket failed: $!"; + +$s->setsockopt(SOL_SOCKET, SO_SPLICE, pack('i', 0)) + and die "splice with non non-socket fileno succeeded"; +$!{ENOTSOCK} + or die "error not ENOTSOCK: $!" |