-
Notifications
You must be signed in to change notification settings - Fork 550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] socket() sometimes does not set $! on failure on win32 #16849
Comments
From @xenuC:\Users\xenu>perl -MData::Dumper -MSocket -E "socket(my C:\Users\xenu>perl -MData::Dumper -MSocket -E "socket(my C:\Users\xenu>perl -MData::Dumper -MSocket -E "socket(my Note that it doesn't happen when PERL_ALLOW_NON_IFS_LSP env variable is C:\Users\xenu>set PERL_ALLOW_NON_IFS_LSP=1 |
From @xenuThe patch is attached |
From @xenu0001-win32-win32sck.c-better-socket-error-handling.patchFrom 4be8e84b8f1be71d87c4380f39e4e39f9f976fac Mon Sep 17 00:00:00 2001
From: Tomasz Konojacki <me@xenu.pl>
Date: Tue, 19 Feb 2019 18:16:06 +0100
Subject: [PATCH] win32/win32sck.c: better socket() error handling
When the protocol passed to socket() is unknown, set errno to
WSAEPROTONOSUPPORT.
[perl #133853]
---
win32/win32sck.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/win32/win32sck.c b/win32/win32sck.c
index d9d7f3692b..d285ece082 100644
--- a/win32/win32sck.c
+++ b/win32/win32sck.c
@@ -613,7 +613,7 @@ open_ifs_socket(int af, int type, int protocol)
dTHX;
char *s;
unsigned long proto_buffers_len = 0;
- int error_code;
+ int error_code, found = 0;
SOCKET out = INVALID_SOCKET;
if ((s = PerlEnv_getenv("PERL_ALLOW_NON_IFS_LSP")) && atoi(s))
@@ -645,11 +645,15 @@ open_ifs_socket(int af, int type, int protocol)
if ((proto_buffers[i].dwServiceFlags1 & XP1_IFS_HANDLES) == 0)
continue;
+ found = 1;
convert_proto_info_w2a(&(proto_buffers[i]), &proto_info);
out = WSASocket(af, type, protocol, &proto_info, 0, 0);
break;
}
+
+ if (!found)
+ WSASetLastError(WSAEPROTONOSUPPORT);
}
Safefree(proto_buffers);
--
2.20.1.windows.1
|
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'pending release' |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been Perl 5.30.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133853 (status was 'resolved')
Searchable as RT133853$
The text was updated successfully, but these errors were encountered: