diff --git a/configure.ac b/configure.ac index f6fdb0e..6693c47 100644 --- a/configure.ac +++ b/configure.ac @@ -124,7 +124,7 @@ AS_CASE([$host_os], [linux*|kfreebsd*-gnu|freebsd*], [ libc_name=`ldd /usr/bin/yes | grep 'libc\.' | cut -d ' ' -f 1 | tr -d '\t'` - if test "${libc_name}" == ""; then + if test "${libc_name}" = ""; then # Default libc on most system. libc_name="libc.so.6" fi diff --git a/src/lib/accept.c b/src/lib/accept.c index 80434fc..9866b62 100644 --- a/src/lib/accept.c +++ b/src/lib/accept.c @@ -87,7 +87,7 @@ LIBC_ACCEPT_DECL return tsocks_accept(LIBC_ACCEPT_ARGS); } -#if (defined(__linux__)) +#if (defined(__linux__) || defined(__NetBSD__)) TSOCKS_LIBC_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG) diff --git a/src/lib/torsocks.h b/src/lib/torsocks.h index 33da526..38eb079 100644 --- a/src/lib/torsocks.h +++ b/src/lib/torsocks.h @@ -242,6 +242,9 @@ struct hostent **result, int *h_errnop #define LIBC_SYSCALL_SIG long int number, ... #define LIBC_SYSCALL_ARGS number +#endif /* __linux__ */ + +#if defined(__linux__) || defined(__NetBSD__) /* accept4(2) */ #define LIBC_ACCEPT4_NAME accept4 #define LIBC_ACCEPT4_NAME_STR XSTR(LIBC_ACCEPT4_NAME) @@ -249,8 +252,8 @@ struct hostent **result, int *h_errnop #define LIBC_ACCEPT4_SIG \ int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags #define LIBC_ACCEPT4_ARGS sockfd, addr, addrlen, flags +#endif -#endif /* __linux__ */ #if (defined(__FreeBSD__) || defined(__darwin__) || defined(__NetBSD__)) @@ -414,7 +417,7 @@ TSOCKS_DECL(accept, LIBC_ACCEPT_RET_TYPE, LIBC_ACCEPT_SIG) LIBC_ACCEPT_NAME(LIBC_ACCEPT_SIG) /* accept4(2) */ -#if (defined(__linux__)) +#if (defined(__linux__) || defined(__NetBSD__)) extern TSOCKS_LIBC_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG) TSOCKS_DECL(accept4, LIBC_ACCEPT4_RET_TYPE, LIBC_ACCEPT4_SIG) #define LIBC_ACCEPT4_DECL LIBC_ACCEPT4_RET_TYPE \