Merge "gethostbyname: fix crash"
diff --git a/libc/netbsd/gethnamaddr.c b/libc/netbsd/gethnamaddr.c
index 2cb5fd3..ee5052e 100644
--- a/libc/netbsd/gethnamaddr.c
+++ b/libc/netbsd/gethnamaddr.c
@@ -757,8 +757,7 @@
/* This is writing to system/netd/DnsProxyListener.cpp and changes
* here need to be matched there */
- if (fprintf(proxy, "gethostbyname %d %s %s %d",
- getpid(),
+ if (fprintf(proxy, "gethostbyname %s %s %d",
iface == NULL ? "^" : iface,
name == NULL ? "^" : name,
af) < 0) {
@@ -792,8 +791,8 @@
const char * addrStr = inet_ntop(af, addr, buf, sizeof(buf));
if (addrStr == NULL) goto exit;
- if (fprintf(proxy, "gethostbyaddr %s %d %d %d %s",
- addrStr, len, af, getpid(), iface == NULL ? "^" : iface) < 0) {
+ if (fprintf(proxy, "gethostbyaddr %s %d %d %s",
+ addrStr, len, af, iface == NULL ? "^" : iface) < 0) {
goto exit;
}
diff --git a/libc/netbsd/net/getaddrinfo.c b/libc/netbsd/net/getaddrinfo.c
index aed6b94..896055d 100644
--- a/libc/netbsd/net/getaddrinfo.c
+++ b/libc/netbsd/net/getaddrinfo.c
@@ -446,15 +446,14 @@
// Send the request.
proxy = fdopen(sock, "r+");
- if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d %s %d",
+ if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d %s",
hostname == NULL ? "^" : hostname,
servname == NULL ? "^" : servname,
hints == NULL ? -1 : hints->ai_flags,
hints == NULL ? -1 : hints->ai_family,
hints == NULL ? -1 : hints->ai_socktype,
hints == NULL ? -1 : hints->ai_protocol,
- iface == NULL ? "^" : iface,
- getpid()) < 0) {
+ iface == NULL ? "^" : iface) < 0) {
goto exit;
}
// literal NULL byte at end, required by FrameworkListener