Fix bugs with DNS library on Windows

This commit is contained in:
Justine Tunney 2024-01-03 17:32:16 -08:00
parent 1bb52c223b
commit 34ed1fcbea
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
6 changed files with 12 additions and 4 deletions

View file

@ -23,6 +23,6 @@ const char *GetHostsTxtPath(char *path, size_t size) {
if (!IsWindows()) {
return "/etc/hosts";
} else {
return GetSystemDirectoryPath(path, "drivers\\etc\\hosts", size);
return GetSystemDirectoryPath(path, "\\drivers\\etc\\hosts", size);
}
}

View file

@ -23,6 +23,6 @@ const char *GetProtocolsTxtPath(char *buf, size_t size) {
if (!IsWindows()) {
return "/etc/protocols";
} else {
return GetSystemDirectoryPath(buf, "drivers\\etc\\protocol", size);
return GetSystemDirectoryPath(buf, "\\drivers\\etc\\protocol", size);
}
}

View file

@ -23,6 +23,6 @@ const char *GetServicesTxtPath(char *path, size_t size) {
if (!IsWindows()) {
return "/etc/services";
} else {
return GetSystemDirectoryPath(path, "drivers\\etc\\services", size);
return GetSystemDirectoryPath(path, "\\drivers\\etc\\services", size);
}
}

View file

@ -33,6 +33,7 @@
#include "libc/intrin/describebacktrace.internal.h"
#include "libc/intrin/dll.h"
#include "libc/intrin/strace.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/nt/console.h"
#include "libc/nt/enum/context.h"
#include "libc/nt/enum/exceptionhandleractions.h"
@ -43,6 +44,7 @@
#include "libc/nt/struct/ntexceptionpointers.h"
#include "libc/nt/synchronization.h"
#include "libc/nt/thread.h"
#include "libc/runtime/symbols.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/sa.h"
#include "libc/sysv/consts/sicode.h"
@ -525,7 +527,9 @@ static void __sig_unmaskable(struct NtExceptionPointers *ep, int code, int sig,
// otherwise it'll print a warning message about the lack of stack mem
STRACE("win32 vectored exception 0x%08Xu raising %G "
"cosmoaddr2line %s %lx %s",
ep->ExceptionRecord->ExceptionCode, sig, program_invocation_name,
ep->ExceptionRecord->ExceptionCode, sig,
_weaken(FindDebugBinary) ? _weaken(FindDebugBinary)()
: program_invocation_name,
ep->ContextRecord->Rip,
DescribeBacktrace((struct StackFrame *)ep->ContextRecord->Rbp));

View file

@ -445,6 +445,9 @@ textstartup void __printargs(const char *prologue) {
PRINT(" ☼ %s = %#s", "kNtWindowsDirectory", kNtWindowsDirectory);
#endif
PRINT(" ☼ %s = %#s", "__argv[0]", __argv[0]);
PRINT(" ☼ %s = %#s", "program_invocation_name", program_invocation_name);
PRINT(" ☼ %s = %#s", "program_invocation_short_name",
program_invocation_short_name);
PRINT(" ☼ %s = %#s", "getenv(\"_\")", getenv("_"));
PRINT(" ☼ %s = %#s", "getauxval(AT_EXECFN)", getauxval(AT_EXECFN));
PRINT(" ☼ %s = %#s", "GetProgramExecutableName", GetProgramExecutableName());

View file

@ -63,6 +63,7 @@ static dontinline textwindows int __get_resolv_conf_nt(struct resolvconf *conf)
return __winerr();
}
conf->nns = 0;
for (i = 0; i < keycount; ++i) {
char value8[128];
uint32_t valuebytes, uuidlen;