diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 9da2a84b0003..2b633025482b 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -657,8 +657,8 @@ status(argc, argv) } pswitch(0); } - printf("Gate ftp: %s, server %s, port %d.\n", onoff(gatemode), - *gateserver ? gateserver : "(none)", ntohs(gateport)); + printf("Gate ftp: %s, server %s, port %s.\n", onoff(gatemode), + *gateserver ? gateserver : "(none)", gateport); printf("Passive mode: %s.\n", onoff(passivemode)); printf("Mode: %s; Type: %s; Form: %s; Structure: %s.\n", modename, typename, formname, structname); @@ -889,7 +889,9 @@ setgate(argc, argv) code = -1; return; } - gateport = htons(port); + if (gateport != NULL) + free(gateport); + asprintf(&gateport, "%ld", port); } strncpy(gsbuf, argv[1], sizeof(gsbuf) - 1); gsbuf[sizeof(gsbuf) - 1] = '\0'; @@ -902,8 +904,8 @@ setgate(argc, argv) "Disabling gate-ftp mode - no gate-ftp server defined.\n"); gatemode = 0; } else { - printf("Gate ftp: %s, server %s, port %d.\n", onoff(gatemode), - *gateserver ? gateserver : "(none)", ntohs(gateport)); + printf("Gate ftp: %s, server %s, port %s.\n", onoff(gatemode), + *gateserver ? gateserver : "(none)", gateport); } code = gatemode; } diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index 0643e5d78423..ae5a2faaa7f0 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -114,10 +114,12 @@ url_get(origline, proxyenv) s = -1; proxy = NULL; isftpurl = 0; + res0 = NULL; #ifdef __GNUC__ /* XXX: to shut up gcc warnings */ (void)&savefile; (void)&proxy; + (void)&res0; #endif line = strdup(origline); diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index 8d3866950630..1862333608c4 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1178,6 +1178,9 @@ initconn() #endif if (passivemode) { +#ifdef __GNUC__ /* XXX: to shut up gcc warnings */ + (void)&pasvcmd; +#endif data_addr = myctladdr; data = socket(data_addr.su_family, SOCK_STREAM, 0); if (data < 0) { @@ -1327,7 +1330,6 @@ initconn() } } else if (strcmp(pasvcmd, "EPSV") == 0) { char delim[4]; - char *tcpport; prt[0] = 0; if (code / 10 == 22 && code != 229) { diff --git a/usr.bin/ftp/ftp_var.h b/usr.bin/ftp/ftp_var.h index 75cb5da0dbcd..c13b32ca27ea 100644 --- a/usr.bin/ftp/ftp_var.h +++ b/usr.bin/ftp/ftp_var.h @@ -45,6 +45,7 @@ #include #include #include +#include #ifndef SMALL #include diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index f38d3b00985b..dd1f210fa940 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -79,11 +79,9 @@ main(argc, argv) int argc; char *argv[]; { - struct servent *sp; int ch, top, rval; - long port; struct passwd *pw = NULL; - char *cp, *ep, homedir[MAXPATHLEN], *s; + char *cp, homedir[MAXPATHLEN], *s; int dumbterm; char *src_addr = NULL; @@ -94,9 +92,9 @@ main(argc, argv) gateport = NULL; cp = getenv("FTPSERVERPORT"); if (cp != NULL) - gateport = cp; + asprintf(&gateport, "%s", cp); if (!gateport) - gateport = "ftpgate"; + asprintf(&gateport, "ftpgate"); doglob = 1; interactive = 1; autologin = 1; @@ -234,7 +232,6 @@ main(argc, argv) if (dobind) { struct addrinfo hints; struct addrinfo *res; - char *ftpdataport = "ftp-data"; int error; memset(&hints, 0, sizeof(hints));