mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-05 09:20:29 +00:00
fix nt accept not initializing with SO_UPDATE_ACCEPT_CONTEXT
This commit is contained in:
parent
fcfdd26b72
commit
ecd3af1ac2
2 changed files with 6 additions and 6 deletions
|
@ -87,10 +87,6 @@ static int sys_accept_nt_start(int64_t handle, struct NtOverlapped *overlap,
|
|||
if (g_acceptex.lpAcceptEx(args->listensock, handle, args->buffer, 0,
|
||||
sizeof(args->buffer->local),
|
||||
sizeof(args->buffer->remote), 0, overlap)) {
|
||||
// inherit properties of listening socket
|
||||
unassert(!__imp_setsockopt(args->listensock, SOL_SOCKET,
|
||||
kNtSoUpdateAcceptContext, &handle,
|
||||
sizeof(handle)));
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
|
@ -123,6 +119,12 @@ textwindows int sys_accept_nt(struct Fd *f, struct sockaddr_storage *addr,
|
|||
goto Finish;
|
||||
}
|
||||
|
||||
// inherit properties of listening socket
|
||||
// errors ignored as if f->handle was created before forking
|
||||
// this fails with WSAENOTSOCK
|
||||
__imp_setsockopt(resources.handle, SOL_SOCKET, kNtSoUpdateAcceptContext,
|
||||
&f->handle, sizeof(f->handle));
|
||||
|
||||
// create file descriptor for new socket
|
||||
// don't inherit the file open mode bits
|
||||
int oflags = 0;
|
||||
|
|
|
@ -152,8 +152,6 @@ __attribute__((__constructor__)) static void StdioPro(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
TEST(socket, canBeUsedAsExecutedStdio) {
|
||||
if (IsWindows())
|
||||
return; // TODO(jart): What broke this?
|
||||
char buf[16] = {0};
|
||||
const char *prog;
|
||||
uint32_t addrsize = sizeof(struct sockaddr_in);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue