Change 13921 by jhi@alpha on 2001/12/29 15:05:08
socketpair tweaks from Nicholas Clark.
Affected files ...
.... //depot/perl/ext/Socket/socketpair.t#5 edit
.... //depot/perl/util.c#310 edit
Differences ...
==== //depot/perl/ext/Socket/socketpair.t#5 (text) ====
Index: perl/ext/Socket/socketpair.t
--- perl/ext/Socket/socketpair.t.~1~ Sat Dec 29 08:15:05 2001
+++ perl/ext/Socket/socketpair.t Sat Dec 29 08:15:05 2001
@@ -15,7 +15,7 @@
use Test::More;
use strict;
use warnings;
-use Errno 'EPIPE';
+use Errno qw(EPIPE ESHUTDOWN);
my $skip_reason;
@@ -89,7 +89,7 @@
}
SKIP: {
# This may need skipping on some OSes
- ok ($! == EPIPE, '$! should be EPIPE')
+ ok (($! == EPIPE or $! == ESHUTDOWN), '$! should be EPIPE or ESHUTDOWN')
or printf "\$\!=%d(%s)\n", $!, $!;
}
==== //depot/perl/util.c#310 (text) ====
Index: perl/util.c
--- perl/util.c.~1~ Sat Dec 29 08:15:05 2001
+++ perl/util.c Sat Dec 29 08:15:05 2001
@@ -4127,7 +4127,7 @@
int
Perl_my_socketpair (int family, int type, int protocol, int fd[2]) {
/* Stevens says that family must be AF_LOCAL, protocol 0.
- I'm going to enforce that, then ignore it, and use TCP. */
+ I'm going to enforce that, then ignore it, and use TCP (or UDP). */
int listener = -1;
int connector = -1;
int acceptor = -1;
@@ -4143,8 +4143,10 @@
errno = EAFNOSUPPORT;
return -1;
}
- if (!fd)
- return EINVAL;
+ if (!fd) {
+ errno = EINVAL;
+ return -1;
+ }
if (type == SOCK_DGRAM)
return S_socketpair_udp (fd);
End of Patch.