Cleanup socket code

This commit is contained in:
Justine Tunney 2021-02-05 23:45:34 -08:00
parent a91ba89d85
commit e06c90fafc
13 changed files with 108 additions and 94 deletions

View file

@ -44,11 +44,11 @@ int close(int fd) {
} else if (!IsWindows()) {
rc = sys_close(fd);
} else if (fd < g_fds.n && g_fds.p[fd].kind == kFdSocket) {
rc = weaken(sys_closesocket_nt)(fd);
rc = weaken(sys_closesocket_nt)(g_fds.p + fd);
} else if (fd < g_fds.n &&
(g_fds.p[fd].kind == kFdFile || g_fds.p[fd].kind == kFdConsole ||
g_fds.p[fd].kind == kFdProcess)) {
rc = sys_close_nt(fd);
rc = sys_close_nt(g_fds.p + fd);
} else {
rc = ebadf();
}