Fix a bunch of Windows bugs reported on Discord

This change addresses everything from stack smashing to %SYSTEMROOT%
breaking socket(). Issues relating to compile.com not reporting text
printed to stderr has been resolved for Windows builds.
This commit is contained in:
Justine Tunney 2023-07-28 06:17:34 -07:00
parent b0e3258709
commit 5018171fa5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
10 changed files with 104 additions and 46 deletions

View file

@ -24,6 +24,7 @@
#include "libc/log/log.h"
#include "libc/mem/gc.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/ifconf.h"
#include "libc/sock/struct/ifreq.h"
@ -32,6 +33,7 @@
#include "libc/sysv/consts/ipproto.h"
#include "libc/sysv/consts/sio.h"
#include "libc/sysv/consts/sock.h"
#include "libc/testlib/subprocess.h"
#include "libc/testlib/testlib.h"
TEST(siocgifconf, test) {
@ -70,3 +72,12 @@ TEST(siocgifconf, test) {
EXPECT_TRUE(foundloopback);
ASSERT_NE(-1, close(socketfd));
}
TEST(siocgifconf, mkntenvblock_systemroot) {
if (__argc != 1) return;
SPAWN(fork);
execve(GetProgramExecutableName(),
(char *[]){GetProgramExecutableName(), "hi", NULL}, (char *[]){NULL});
abort();
EXITS(0);
}