summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjbj <devnull@localhost>1999-01-21 19:14:31 +0000
committerjbj <devnull@localhost>1999-01-21 19:14:31 +0000
commite13cffa7460b2069bb9ad67af2525d80a1e018d8 (patch)
tree4dc3e2fb54837bcf24411c9de64d67e2e1fa0e08
parent4bcd4d620df2afd3b448ded4eb06e9708ca58165 (diff)
downloadrpm-e13cffa7460b2069bb9ad67af2525d80a1e018d8.tar.gz
rpm-e13cffa7460b2069bb9ad67af2525d80a1e018d8.tar.bz2
rpm-e13cffa7460b2069bb9ad67af2525d80a1e018d8.zip
Fix: clear orphaned "Transfer complete" from ftp control channel if
using ftpGetFileDesc() access with cached control connection. CVS patchset: 2730 CVS date: 1999/01/21 19:14:31
-rw-r--r--ftp.c29
-rw-r--r--po/rpm.pot28
-rw-r--r--url.h1
3 files changed, 36 insertions, 22 deletions
diff --git a/ftp.c b/ftp.c
index 5d9c84a38..41185bb4e 100644
--- a/ftp.c
+++ b/ftp.c
@@ -52,10 +52,12 @@ int inet_aton(const char *cp, struct in_addr *inp);
static int ftpDebug = 0;
static int ftpTimeoutSecs = TIMEOUT_SECS;
+#ifdef DYING
static int ftpCheckResponse(urlinfo *u, char ** str);
static int ftpCommand(urlinfo *u, char * command, ...);
static int copyData(FD_t sfd, FD_t tfd);
static int getHostAddress(const char * host, struct in_addr * address);
+#endif
static int ftpCheckResponse(urlinfo *u, char ** str) {
static char buf[BUFFER_SIZE + 1];
@@ -148,7 +150,7 @@ fprintf(stderr, "<- %s\n", buf);
return 0;
}
-int ftpCommand(urlinfo *u, char * command, ...) {
+static int ftpCommand(urlinfo *u, char * command, ...) {
va_list ap;
int len;
char * s;
@@ -347,7 +349,7 @@ int ftpOpen(urlinfo *u)
return u->ftpControl;
}
-int copyData(FD_t sfd, FD_t tfd) {
+static int copyData(FD_t sfd, FD_t tfd) {
char buf[BUFFER_SIZE];
fd_set emptySet, readSet;
struct timeval timeout;
@@ -424,6 +426,13 @@ fprintf(stderr, "-> ABOR\n");
return 0;
}
+static int ftpGetFileDone(urlinfo *u) {
+ if (u->ftpGetFileDoneNeeded && ftpCheckResponse(u, NULL))
+ return FTPERR_BAD_SERVER_RESPONSE;
+ u->ftpGetFileDoneNeeded = 0;
+ return 0;
+}
+
int ftpGetFileDesc(FD_t fd)
{
urlinfo *u;
@@ -438,6 +447,15 @@ int ftpGetFileDesc(FD_t fd)
u = (urlinfo *)fd->fd_url;
remotename = u->path;
+/*
+ * XXX When ftpGetFileDesc() is called, there may be a lurking
+ * XXX transfer complete message (if ftpGetFileDone() was not
+ * XXX called to clear that message). Clear that message now.
+ */
+
+ if (u->ftpGetFileDoneNeeded)
+ rc = ftpGetFileDone(u);
+
if (ftpDebug)
fprintf(stderr, "-> PASV\n");
if (write(u->ftpControl, "PASV\r\n", 6) != 6) {
@@ -507,12 +525,7 @@ fprintf(stderr, "-> %s", retrCommand);
return rc;
}
- return 0;
-}
-
-static int ftpGetFileDone(urlinfo *u) {
- if (ftpCheckResponse(u, NULL))
- return FTPERR_BAD_SERVER_RESPONSE;
+ u ->ftpGetFileDoneNeeded = 1;
return 0;
}
diff --git a/po/rpm.pot b/po/rpm.pot
index 4f49f3a14..f73618c4b 100644
--- a/po/rpm.pot
+++ b/po/rpm.pot
@@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 1999-01-21 10:57-0500\n"
+"POT-Creation-Date: 1999-01-21 14:10-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -175,55 +175,55 @@ msgstr ""
msgid "OK"
msgstr ""
-#: ../ftp.c:554
+#: ../ftp.c:567
msgid "Success"
msgstr ""
-#: ../ftp.c:557
+#: ../ftp.c:570
msgid "Bad server response"
msgstr ""
-#: ../ftp.c:560
+#: ../ftp.c:573
msgid "Server IO error"
msgstr ""
-#: ../ftp.c:563
+#: ../ftp.c:576
msgid "Server timeout"
msgstr ""
-#: ../ftp.c:566
+#: ../ftp.c:579
msgid "Unable to lookup server host address"
msgstr ""
-#: ../ftp.c:569
+#: ../ftp.c:582
msgid "Unable to lookup server host name"
msgstr ""
-#: ../ftp.c:572
+#: ../ftp.c:585
msgid "Failed to connect to server"
msgstr ""
-#: ../ftp.c:575
+#: ../ftp.c:588
msgid "Failed to establish data connection to server"
msgstr ""
-#: ../ftp.c:578
+#: ../ftp.c:591
msgid "IO error to local file"
msgstr ""
-#: ../ftp.c:581
+#: ../ftp.c:594
msgid "Error setting remote server to passive mode"
msgstr ""
-#: ../ftp.c:584
+#: ../ftp.c:597
msgid "File not found on server"
msgstr ""
-#: ../ftp.c:587
+#: ../ftp.c:600
msgid "Abort in progress"
msgstr ""
-#: ../ftp.c:591
+#: ../ftp.c:604
msgid "Unknown or unexpected error"
msgstr ""
diff --git a/url.h b/url.h
index 63e07723c..9d5b6adc6 100644
--- a/url.h
+++ b/url.h
@@ -18,6 +18,7 @@ typedef struct urlinfo {
const char *path;
int port;
int ftpControl;
+ int ftpGetFileDoneNeeded;
} urlinfo;
#ifndef IPPORT_HTTP