Fix getpeername() bug on Windows

The WIN32 getpeername() function returns ENOTCONN when it uses connect()
the SOCK_NONBLOCK way. So we simply store the address, provided earlier.
This commit is contained in:
Justine Tunney 2024-08-25 11:26:21 -07:00
parent 908b7a82ca
commit f3ce684aef
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
4 changed files with 71 additions and 3 deletions

View file

@ -1,5 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_
#define COSMOPOLITAN_LIBC_CALLS_STRUCT_FD_INTERNAL_H_
#include "libc/sock/struct/sockaddr.h"
#include "libc/thread/thread.h"
COSMOPOLITAN_C_START_
@ -37,6 +38,7 @@ struct Fd {
unsigned sndtimeo; /* millis; 0 means wait forever */
void *connect_op;
struct Cursor *cursor;
struct sockaddr_storage peer;
};
struct Fds {