blob: 228536efafbed9cab1d0c95e4edcf128398d231f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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: $!"
|