diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | lib/x509/output.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 25796ca141..936978e3bc 100644 --- a/configure.ac +++ b/configure.ac @@ -145,7 +145,7 @@ AC_C_BIGENDIAN dnl No fork on MinGW, disable some self-tests until we fix them. dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs) -AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime iconv localtime vasprintf],,) +AC_CHECK_FUNCS([fork inet_ntop getrusage getpwuid_r nanosleep daemon getpid clock_gettime iconv localtime vasprintf],,) AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no") AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h> diff --git a/lib/x509/output.c b/lib/x509/output.c index faafa70859..ca02514af3 100644 --- a/lib/x509/output.c +++ b/lib/x509/output.c @@ -31,6 +31,10 @@ #include <gnutls_errors.h> #include <extras/randomart.h> +#ifdef HAVE_INET_NTOP +# include <arpa/inet.h> +#endif + #define addf _gnutls_buffer_append_printf #define adds _gnutls_buffer_append_str @@ -57,6 +61,12 @@ static char *ip_to_string(void *_ip, int ip_size, char *string, return NULL; } +#ifdef HAVE_INET_NTOP + if (ip_size == 4) + return inet_ntop(AF_INET, _ip, string, string_size); + else + return inet_ntop(AF_INET6, _ip, string, string_size); +#else ip = _ip; switch (ip_size) { case 4: @@ -71,8 +81,8 @@ static char *ip_to_string(void *_ip, int ip_size, char *string, (ip[12] << 8) | ip[13], (ip[14] << 8) | ip[15]); break; } - return string; +#endif } static void |