commit 5cfa671f15accb5ca90c4bd41c831c0216d33b37 Author: David Goulet dgoulet@ev0ke.net Date: Sat Nov 2 22:42:15 2013 -0400
Fix: don't lookup symbol if already found
Signed-off-by: David Goulet dgoulet@ev0ke.net --- src/lib/getaddrinfo.c | 7 +++++-- src/lib/getpeername.c | 6 ++++-- src/lib/recv.c | 9 ++++++--- src/lib/socketpair.c | 9 ++++++--- 4 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/lib/getaddrinfo.c b/src/lib/getaddrinfo.c index 7a7a144..7d60e3e 100644 --- a/src/lib/getaddrinfo.c +++ b/src/lib/getaddrinfo.c @@ -99,7 +99,10 @@ error: */ LIBC_GETADDRINFO_DECL { - tsocks_libc_getaddrinfo = tsocks_find_libc_symbol(LIBC_GETADDRINFO_NAME_STR, - TSOCKS_SYM_EXIT_NOT_FOUND); + if (!tsocks_libc_getaddrinfo) { + tsocks_libc_getaddrinfo = tsocks_find_libc_symbol( + LIBC_GETADDRINFO_NAME_STR, TSOCKS_SYM_EXIT_NOT_FOUND); + } + return tsocks_getaddrinfo(LIBC_GETADDRINFO_ARGS); } diff --git a/src/lib/getpeername.c b/src/lib/getpeername.c index 2315ace..0b0ad9b 100644 --- a/src/lib/getpeername.c +++ b/src/lib/getpeername.c @@ -57,8 +57,10 @@ LIBC_GETPEERNAME_DECL { int ret;
- tsocks_libc_getpeername = tsocks_find_libc_symbol(LIBC_GETPEERNAME_NAME_STR, - TSOCKS_SYM_EXIT_NOT_FOUND); + if (!tsocks_libc_getpeername) { + tsocks_libc_getpeername = tsocks_find_libc_symbol( + LIBC_GETPEERNAME_NAME_STR, TSOCKS_SYM_EXIT_NOT_FOUND); + }
ret = tsocks_libc_getpeername(LIBC_GETPEERNAME_ARGS); if (ret < 0) { diff --git a/src/lib/recv.c b/src/lib/recv.c index 9f9aefc..11b2e7b 100644 --- a/src/lib/recv.c +++ b/src/lib/recv.c @@ -99,8 +99,11 @@ end: */ LIBC_RECVMSG_DECL { - /* Find symbol if not already set. Exit if not found. */ - tsocks_libc_recvmsg = tsocks_find_libc_symbol(LIBC_RECVMSG_NAME_STR, - TSOCKS_SYM_EXIT_NOT_FOUND); + if (!tsocks_libc_recvmsg) { + /* Find symbol if not already set. Exit if not found. */ + tsocks_libc_recvmsg = tsocks_find_libc_symbol(LIBC_RECVMSG_NAME_STR, + TSOCKS_SYM_EXIT_NOT_FOUND); + } + return tsocks_recvmsg(LIBC_RECVMSG_ARGS); } diff --git a/src/lib/socketpair.c b/src/lib/socketpair.c index 599b4c3..8889410 100644 --- a/src/lib/socketpair.c +++ b/src/lib/socketpair.c @@ -54,8 +54,11 @@ LIBC_SOCKETPAIR_RET_TYPE tsocks_socketpair(LIBC_SOCKETPAIR_SIG) */ LIBC_SOCKETPAIR_DECL { - /* Find symbol if not already set. Exit if not found. */ - tsocks_libc_socketpair = tsocks_find_libc_symbol(LIBC_SOCKETPAIR_NAME_STR, - TSOCKS_SYM_EXIT_NOT_FOUND); + if (!tsocks_libc_socketpair) { + /* Find symbol if not already set. Exit if not found. */ + tsocks_libc_socketpair = tsocks_find_libc_symbol( + LIBC_SOCKETPAIR_NAME_STR, TSOCKS_SYM_EXIT_NOT_FOUND); + } + return tsocks_socketpair(LIBC_SOCKETPAIR_ARGS); }
tor-commits@lists.torproject.org