diff options
author | Tony Cook <tony@develop-help.com> | 2014-01-13 16:20:00 +1100 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2014-01-15 09:37:26 +1100 |
commit | e122534c08d52962b50cef019dffa861efbfb801 (patch) | |
tree | a149a9fb9ab6bdb305d338dd13a7e561adc8fa53 /pp_sys.c | |
parent | 171b35b00178c63555d0095adc2f2e6a72b3d772 (diff) | |
download | perl-e122534c08d52962b50cef019dffa861efbfb801.tar.gz |
[perl #118843] work around recv() behaviour on cygwin
cygwin inherits recv behaviour from the Win32 sockets API which doesn't
modify the namebuf or it's associated size when you recv() from a
connected socket, handle this the same way Win32 does by zeroing the
length if it's the same as before calling recv().
Also adds some basic socket function tests to the core tests.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1711,6 +1711,14 @@ PP(pp_sysread) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(bufsv); SP = ORIGMARK; +#if defined(__CYGWIN__) + /* recvfrom() on cygwin doesn't set bufsize at all for + connected sockets, leaving us with trash in the returned + name, so use the same test as the Win32 code to check if it + wasn't set, and set it [perl #118843] */ + if (bufsize == sizeof namebuf) + bufsize = 0; +#endif sv_setpvn(TARG, namebuf, bufsize); PUSHs(TARG); RETURN; |