From 29be90b7037fd8d802902573bc5f0f71f4ef40fe Mon Sep 17 00:00:00 2001 From: Mikael Hallendal Date: Sun, 26 Oct 2008 14:45:12 +0100 Subject: Patch for asyncns.c on Mac OS X Hi Lennart, I have a copy of libasyncns in Loudmouth and just updated it to the version in 0.6 which required the following patch in order to build on Mac OS X. * arpa/nameser_compat.h seems to get included by nameser.h on Linux but not on Mac OS X. * Removed an unused variable that caused the compiler to complain when building with warnings * Both Mac OS X and Linux seems to define NSIG (on Linux to _NSIG and on Mac OS X to __DARWIN_NSIG. Thanks for your nice work on the lib and hope the patch may be of some use. Cheers, Micke Signed-off-by: Lennart Poettering --- libasyncns/asyncns.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libasyncns/asyncns.c b/libasyncns/asyncns.c index 3fc737f..054faa3 100644 --- a/libasyncns/asyncns.c +++ b/libasyncns/asyncns.c @@ -41,6 +41,10 @@ #include #include +#if HAVE_ARPA_NAMESER_COMPAT_H +#include +#endif + #ifdef HAVE_SYS_PRCTL_H #include #endif @@ -201,7 +205,6 @@ static char *strndup(const char *s, size_t l) { static int close_allv(const int except_fds[]) { struct rlimit rl; int fd; - int saved_errno; #ifdef __linux__ @@ -255,6 +258,8 @@ static int close_allv(const int except_fds[]) { continue; if (close(fd) < 0) { + int saved_errno; + saved_errno = errno; closedir(d); errno = saved_errno; @@ -293,7 +298,7 @@ static int reset_sigsv(const int except[]) { int sig; assert(except); - for (sig = 1; sig < _NSIG; sig++) { + for (sig = 1; sig < NSIG; sig++) { int reset = 1; switch (sig) { -- cgit