diff options
author | Koichiro IWAO <meta@vmeta.jp> | 2016-02-23 15:14:22 +0900 |
---|---|---|
committer | Koichiro IWAO <meta@vmeta.jp> | 2016-02-23 18:18:28 +0900 |
commit | 1ed7dbec53aec2cd9f7fb4afbb48abf199b2e01b (patch) | |
tree | 78ca2d6a0ed0aafead5621563aa7bcbd662c3766 /common | |
parent | f100036cd9e2b65fd8fdc315b176bcca4dd09a51 (diff) | |
download | xrdp-proprietary-1ed7dbec53aec2cd9f7fb4afbb48abf199b2e01b.tar.gz xrdp-proprietary-1ed7dbec53aec2cd9f7fb4afbb48abf199b2e01b.zip |
common: add log for g_tcp_connect
in case getaddrinfo(3) might fail.
In FreeBSD, AI_V4MAPPED support for getaddrinfo(3) was very recently
implemented[1]. Most of FreeBSD systems in the world do not have
this implementation yet. This will be a problem when AI_V4MAPPED
isn't supported and xrdp is built with IPv6 option. In such a case,
g_tcp_connect always fails.
Of course getaddrinfo(3) might fail in other cases. The log helps
us to know what's happening.
[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198092
Diffstat (limited to 'common')
-rw-r--r-- | common/os_calls.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/os_calls.c b/common/os_calls.c index a4c98a75..f02b8c65 100644 --- a/common/os_calls.c +++ b/common/os_calls.c @@ -668,6 +668,7 @@ int APP_CC g_tcp_connect(int sck, const char *address, const char *port) { int res = 0; + char errorMsg[256]; struct addrinfo p; struct addrinfo *h = (struct addrinfo *)NULL; struct addrinfo *rp = (struct addrinfo *)NULL; @@ -693,6 +694,12 @@ g_tcp_connect(int sck, const char *address, const char *port) { res = getaddrinfo(address, port, &p, &h); } + if (res != 0) + { + snprintf(errorMsg, 255, "g_tcp_connect: getaddrinfo() failed: %s", + gai_strerror(res)); + log_message(LOG_LEVEL_ERROR, errorMsg); + } if (res > -1) { if (h != NULL) |