Ticket #169: 0001-work-around-inet_ntop-inet_pton-problems-for-MSVC-bu.patch

File 0001-work-around-inet_ntop-inet_pton-problems-for-MSVC-bu.patch, 1.8 KB (added by Gert Döring, 12 years ago)

this should fix it - see discussion on the list

  • socket.c

    From 853662a6d1f5ad90e8d73032cea137541f6194e2 Mon Sep 17 00:00:00 2001
    From: Gert Doering <gert@greenie.muc.de>
    Date: Thu, 24 Nov 2011 19:48:27 +0100
    Subject: [PATCH] work around inet_ntop/inet_pton problems for MSVC builds on
     WinXP
    
    always use our built-in replacement functions now, even if building
    on Win7 (which has inet_ntop/inet_pton in the system libraries) because
    the resulting binary will then fail on WinXP.
    
    Signed-off-by: Gert Doering <gert@greenie.muc.de>
    ---
     socket.c |    3 ---
     win32.h  |   10 ++++++----
     2 files changed, 6 insertions(+), 7 deletions(-)
    
    diff --git a/socket.c b/socket.c
    index 5302eca..d91f2dc 100644
    a b link_socket_write_udp_posix_sendmsg (struct link_socket *sock, 
    30853085 * WSAAddressToString() and WSAStringToAddress() functions
    30863086 */
    30873087
    3088 #ifndef _MSC_VER
    30893088const char *
    30903089inet_ntop(int af, const void *src, char *dst, socklen_t size)
    30913090{
    inet_pton(int af, const char *src, void *dst) 
    31343133  return 0;
    31353134}
    31363135
    3137 #endif
    3138 
    31393136int
    31403137socket_recv_queue (struct link_socket *sock, int maxsize)
    31413138{
  • win32.h

    diff --git a/win32.h b/win32.h
    index 5b18e3c..0607cad 100644
    a b char *get_win_sys_path (void); 
    278278
    279279/* call self in a subprocess */
    280280void fork_to_self (const char *cmdline);
    281 #ifndef _MSC_VER
    282 const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
    283 int inet_pton(int af, const char *src, void *st);
    284 #endif
     281
     282const char *openvpn_inet_ntop(int af, const void *src,
     283                              char *dst, socklen_t size);
     284int openvpn_inet_pton(int af, const char *src, void *dst);
     285#define inet_ntop(af,src,dst,size) openvpn_inet_ntop(af,src,dst,size)
     286#define inet_pton(af,src,dst)      openvpn_inet_pton(af,src,dst)
    285287
    286288/* Find temporary directory */
    287289const char *win_get_tempdir();