aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-03-31 10:59:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-03-31 10:59:48 +0000
commitce446dbdc230f6a20419e303a583ce268fd899fe (patch)
tree22c1d229c35e523646011f231971e90554a3793e
parentdd2add82ee5717446f365239eead0974e171d506 (diff)
Moved the NI_WITHSCOPEID magic #ifdef to the top of the file and made sure
we use the NIFLAGS properly on both places in the code that use getnameinfo().
-rw-r--r--lib/ftp.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 03a6ab45b..a8923c0cf 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -105,6 +105,12 @@
#include "memdebug.h"
#endif
+#ifdef NI_WITHSCOPEID
+#define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID
+#else
+#define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV
+#endif
+
/* Local API functions */
static CURLcode ftp_sendquote(struct connectdata *conn,
struct curl_slist *quote);
@@ -1074,14 +1080,9 @@ ftp_pasv_verbose(struct connectdata *conn,
char hbuf[NI_MAXHOST]; /* ~1KB */
char nbuf[NI_MAXHOST]; /* ~1KB */
char sbuf[NI_MAXSERV]; /* around 32 */
-#ifdef NI_WITHSCOPEID
- const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
-#else
- const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
-#endif
(void)port; /* prevent compiler warning */
if (getnameinfo(addr->ai_addr, addr->ai_addrlen,
- nbuf, sizeof(nbuf), sbuf, sizeof(sbuf), niflags)) {
+ nbuf, sizeof(nbuf), sbuf, sizeof(sbuf), NIFLAGS)) {
snprintf(nbuf, sizeof(nbuf), "?");
snprintf(sbuf, sizeof(sbuf), "?");
}
@@ -1127,11 +1128,6 @@ CURLcode ftp_use_port(struct connectdata *conn)
char hbuf[NI_MAXHOST];
struct sockaddr *sa=(struct sockaddr *)&ss;
-#ifdef NI_WITHSCOPEID
-#define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID
-#else
-#define NIFLAGS NI_NUMERICHOST | NI_NUMERICSERV
-#endif
unsigned char *ap;
unsigned char *pp;
char portmsgbuf[4096], tmp[4096];