From 933032ce814141bdeb99af4d5a8d63d26f8c9c64 Mon Sep 17 00:00:00 2001 From: Fabrizio Bertocci Date: Sat, 19 Jun 2021 19:39:38 +0200 Subject: [PATCH] Added STATIC_YOINK and the required dependency between sock and IPHLPAPI library --- libc/sock/sock.mk | 1 + libc/sock/socket-nt.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/libc/sock/sock.mk b/libc/sock/sock.mk index 6c533a50b..2f1ee038f 100644 --- a/libc/sock/sock.mk +++ b/libc/sock/sock.mk @@ -33,6 +33,7 @@ LIBC_SOCK_A_DIRECTDEPS = \ LIBC_NT_MSWSOCK \ LIBC_NT_NTDLL \ LIBC_NT_WS2_32 \ + LIBC_NT_IPHLPAPI \ LIBC_RUNTIME \ LIBC_STDIO \ LIBC_STR \ diff --git a/libc/sock/socket-nt.c b/libc/sock/socket-nt.c index 3cdebd76d..f49efe4c7 100644 --- a/libc/sock/socket-nt.c +++ b/libc/sock/socket-nt.c @@ -19,12 +19,16 @@ #include "libc/calls/internal.h" #include "libc/mem/mem.h" #include "libc/nt/winsock.h" +#include "libc/nt/iphlpapi.h" #include "libc/sock/internal.h" #include "libc/sock/yoink.inc" #include "libc/sysv/consts/fio.h" #include "libc/sysv/consts/o.h" #include "libc/sysv/consts/sock.h" +/* ioctl(SIOCGIFCONFIG) uses GetAdaptersAddresses as weak ref */ +STATIC_YOINK("GetAdaptersAddresses"); + textwindows int sys_socket_nt(int family, int type, int protocol) { int64_t h; struct SockFd *sockfd; @@ -42,6 +46,7 @@ textwindows int sys_socket_nt(int family, int type, int protocol) { return __winsockerr(); } } + sockfd = calloc(1, sizeof(struct SockFd)); sockfd->family = family; sockfd->type = truetype;