X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fwin32sck.c;h=271360584026764d56237d5d89a62c2db5eb6cb0;hb=9cc6feabb930fb7cac992ab0a2febf2fb1986667;hp=8929ea7d098811673df145360df26c34003404f4;hpb=87c2f9c4716d6ca80eef0a77058013da1536e87d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/win32sck.c b/win32/win32sck.c index 8929ea7..2713605 100644 --- a/win32/win32sck.c +++ b/win32/win32sck.c @@ -13,10 +13,6 @@ #define WIN32_LEAN_AND_MEAN #ifdef __GNUC__ #define Win32_Winsock -# ifdef __cplusplus -#undef __attribute__ /* seems broken in 2.8.0 */ -#define __attribute__(p) -# endif #endif #include #include "EXTERN.h" @@ -291,8 +287,15 @@ int win32_recvfrom(SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen) { int r; + int frombufsize = *fromlen; SOCKET_TEST_ERROR(r = recvfrom(TO_SOCKET(s), buf, len, flags, from, fromlen)); + /* Winsock's recvfrom() only returns a valid 'from' when the socket + * is connectionless. Perl expects a valid 'from' for all types + * of sockets, so go the extra mile. + */ + if (r != SOCKET_ERROR && frombufsize == *fromlen) + (void)win32_getpeername(s, from, fromlen); return r; }