From d0bbfa8327f2cc08ae5d2e5b13aa8e2641e523e9 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 8 Apr 2021 11:58:51 -0700 Subject: Make res_init() work again. Change 75830fb836621ebbcf68155e466983eb231f9ca1 to fix _nres initialization to be thread safe accidentally introduced a behavior change whereby res_init() became a no-op. It also failed to remove all direct accesses to _nres. Move the file over to C++ so we can let RAII ensure we're always holding a lock while using the global state, make all callers access the global state via this class, and restore the previous behavior of res_init(). Test: atest DnsResolverTest Bug: 166235340 Change-Id: Ib390a7eac063bc0ff5eeba755e8c74ef1383004e --- libc/upstream-netbsd/android/include/netbsd-compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc/upstream-netbsd/android/include/netbsd-compat.h') diff --git a/libc/upstream-netbsd/android/include/netbsd-compat.h b/libc/upstream-netbsd/android/include/netbsd-compat.h index ea630b273..5dd086e41 100644 --- a/libc/upstream-netbsd/android/include/netbsd-compat.h +++ b/libc/upstream-netbsd/android/include/netbsd-compat.h @@ -17,7 +17,7 @@ #pragma once #define _BSD_SOURCE -#define _GNU_SOURCE +#define _GNU_SOURCE 1 // NetBSD uses _DIAGASSERT to null-check arguments and the like, // but it's clear from the number of mistakes in their assertions -- cgit v1.2.3