aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lukemftp/src/ftp.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/lukemftp/src/ftp.c')
-rw-r--r--contrib/lukemftp/src/ftp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/contrib/lukemftp/src/ftp.c b/contrib/lukemftp/src/ftp.c
index b627b2b534b0..b340e85669d0 100644
--- a/contrib/lukemftp/src/ftp.c
+++ b/contrib/lukemftp/src/ftp.c
@@ -149,7 +149,7 @@ hookup(char *host, char *port)
memset(&hints, 0, sizeof(hints));
portnum = parseport(port, FTP_PORT);
hints.ai_flags = AI_CANONNAME;
- hints.ai_family = AF_UNSPEC;
+ hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = 0;
error = getaddrinfo(host, NULL, &hints, &res0);
@@ -453,9 +453,10 @@ getreply(int expecteof)
if (dig > 4 && pflag == 1 && isdigit(c))
pflag = 2;
if (pflag == 2) {
- if (c != '\r' && c != ')')
- *pt++ = c;
- else {
+ if (c != '\r' && c != ')') {
+ if (pt < &pasv[sizeof(pasv) - 1])
+ *pt++ = c;
+ } else {
*pt = '\0';
pflag = 3;
}
@@ -689,7 +690,7 @@ sendrequest(const char *cmd, const char *local, const char *remote,
rc = -1;
switch (curtype) {
case TYPE_A:
- rc = fseek(fin, (long) restart_point, SEEK_SET);
+ rc = fseeko(fin, restart_point, SEEK_SET);
break;
case TYPE_I:
case TYPE_L:
@@ -1134,18 +1135,17 @@ recvrequest(const char *cmd, const char *local, const char *remote,
case TYPE_A:
if (is_retr && restart_point) {
int ch;
- long i, n;
+ off_t i;
- if (fseek(fout, 0L, SEEK_SET) < 0)
+ if (fseeko(fout, (off_t)0, SEEK_SET) < 0)
goto done;
- n = (long)restart_point;
- for (i = 0; i++ < n;) {
+ for (i = 0; i++ < restart_point;) {
if ((ch = getc(fout)) == EOF)
goto done;
if (ch == '\n')
i++;
}
- if (fseek(fout, 0L, SEEK_CUR) < 0) {
+ if (fseeko(fout, (off_t)0, SEEK_CUR) < 0) {
done:
warn("local: %s", local);
goto cleanuprecv;