From a5da1219bb2b7a01f0e2ea2f6548e845c1eb7038 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sat, 12 Nov 2005 22:10:42 +0000 Subject: [PATCH] Reversed the logic for sockaddr_storage and made our own Curl_sockaddr_storage struct instead to use. --- lib/ftp.c | 4 ++-- lib/sockaddr.h | 12 +++++++----- lib/tftp.c | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index 16518d9be..a416dbe9a 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -94,7 +94,7 @@ #include "inet_ntop.h" #include "select.h" #include "parsedate.h" /* for the week day and month names */ -#include "sockaddr.h" /* required for sockaddr_storage */ +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL) #include "inet_ntoa_r.h" @@ -778,7 +778,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn, /****************************************************************** * IPv6-specific section */ - struct sockaddr_storage ss; + struct Curl_sockaddr_storage ss; struct addrinfo *res, *ai; socklen_t sslen; char hbuf[NI_MAXHOST]; diff --git a/lib/sockaddr.h b/lib/sockaddr.h index 938d20b20..1d6a1f464 100644 --- a/lib/sockaddr.h +++ b/lib/sockaddr.h @@ -26,11 +26,13 @@ #include "setup.h" #ifndef HAVE_STRUCT_SOCKADDR_STORAGE -struct sockaddr_storage - { - char buffer[256]; /* this should be big enough to fit a lot */ - }; +struct Curl_sockaddr_storage { + struct sockaddr_storage buffer; +} +#else +struct Curl_sockaddr_storage { + char buffer[256]; /* this should be big enough to fit a lot */ +}; #endif - #endif /* __SOCKADDR_H */ diff --git a/lib/tftp.c b/lib/tftp.c index 0ca45f834..fbc4e9690 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -75,7 +75,7 @@ #include "progress.h" #include "connect.h" #include "strerror.h" -#include "sockaddr.h" /* required for sockaddr_storage */ +#include "sockaddr.h" /* required for Curl_sockaddr_storage */ #define _MPRINTF_REPLACE /* use our functions only */ #include @@ -157,9 +157,9 @@ typedef struct tftp_state_data { time_t start_time; time_t max_time; unsigned short block; - struct sockaddr_storage local_addr; + struct Curl_sockaddr_storage local_addr; socklen_t local_addrlen; - struct sockaddr_storage remote_addr; + struct Curl_sockaddr_storage remote_addr; socklen_t remote_addrlen; int rbytes; int sbytes; @@ -598,7 +598,7 @@ CURLcode Curl_tftp(struct connectdata *conn, bool *done) tftp_event_t event; CURLcode code; int rc; - struct sockaddr_storage fromaddr; + struct Curl_sockaddr_storage fromaddr; socklen_t fromlen; int check_time = 0;