mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
fix recvfrom returning garbage for address on Windows
Uses the same detection method Perl uses for Win32 and Cygwin:
e122534c08 (diff-400754cb38a9f79143e9a5b9248562cfde2ec692b374136149a4bef3d0fdbbac)
This commit is contained in:
parent
771483c4e9
commit
803fbe42e7
1 changed files with 3 additions and 0 deletions
|
@ -70,6 +70,9 @@ ssize_t recvfrom(int fd, void *buf, size_t size, int flags,
|
|||
if (__isfdkind(fd, kFdSocket)) {
|
||||
rc = sys_recvfrom_nt(fd, (struct iovec[]){{buf, size}}, 1, flags, &addr,
|
||||
&addrsize);
|
||||
if (rc != -1 && addrsize == sizeof(addr)) {
|
||||
addrsize = 0;
|
||||
}
|
||||
} else if (__isfdkind(fd, kFdFile) && !opt_out_srcaddr) { /* socketpair */
|
||||
if (!flags) {
|
||||
rc = sys_read_nt(fd, (struct iovec[]){{buf, size}}, 1, -1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue