summaryrefslogtreecommitdiffstats
path: root/lib/libftpio
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1996-11-14 05:22:12 +0000
committerache <ache@FreeBSD.org>1996-11-14 05:22:12 +0000
commit2cca382ac2891877746943b4eefa9bcab9971759 (patch)
tree81731455d7ac268e4388f85eda14d2fbabee9786 /lib/libftpio
parent29f75dec4a8b66e99954aa640d38b14d4013e4b3 (diff)
downloadFreeBSD-src-2cca382ac2891877746943b4eefa9bcab9971759.zip
FreeBSD-src-2cca382ac2891877746943b4eefa9bcab9971759.tar.gz
Oops, forget the fact that several ftp connections can be active
at the same time, so add new con_state to avoid QUIT recursion Still should go to 2.2
Diffstat (limited to 'lib/libftpio')
-rw-r--r--lib/libftpio/ftpio.c12
-rw-r--r--lib/libftpio/ftpio.h4
2 files changed, 6 insertions, 10 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c
index 1fe8537..f9ef0cd 100644
--- a/lib/libftpio/ftpio.c
+++ b/lib/libftpio/ftpio.c
@@ -14,7 +14,7 @@
* Turned inside out. Now returns xfers as new file ids, not as a special
* `state' of FTP_t
*
- * $Id: ftpio.c,v 1.15 1996/10/10 08:34:27 jkh Exp $
+ * $Id: ftpio.c,v 1.16 1996/11/14 05:05:26 ache Exp $
*
*/
@@ -540,21 +540,17 @@ static int
ftp_close(FTP_t ftp)
{
int i;
- static int recursive = 0;
- if (!recursive && ftp->con_state == isopen) {
+ if (ftp->con_state == isopen) {
+ ftp->con_state = quit;
/* Debug("ftp_pkg: in ftp_close(), sending QUIT"); */
- recursive = 1;
i = cmd(ftp, "QUIT");
close(ftp->fd_ctrl);
ftp->fd_ctrl = -1;
- ftp->con_state = init;
if (check_code(ftp, i, FTP_QUIT_HAPPY)) {
- recursive = 0;
ftp->errno = i;
return FAILURE;
}
- recursive = 0;
/* Debug("ftp_pkg: ftp_close() - proper shutdown"); */
return SUCCESS;
}
@@ -580,7 +576,7 @@ cmd(FTP_t ftp, const char *fmt, ...)
(void)vsnprintf(p, sizeof p, fmt, ap);
va_end(ap);
- if (ftp->con_state != isopen)
+ if (ftp->con_state == init)
return botch("cmd", "open");
strcat(p, "\r\n");
diff --git a/lib/libftpio/ftpio.h b/lib/libftpio/ftpio.h
index 2164ebd..7210531 100644
--- a/lib/libftpio/ftpio.h
+++ b/lib/libftpio/ftpio.h
@@ -21,12 +21,12 @@
* Turned inside out. Now returns xfers as new file ids, not as a special
* `state' of FTP_t
*
- * $Id: ftpio.h,v 1.7 1996/08/21 01:12:11 jkh Exp $
+ * $Id: ftpio.h,v 1.8 1996/09/19 17:28:34 peter Exp $
*/
/* Internal housekeeping data structure for FTP sessions */
typedef struct {
- enum { init, isopen } con_state;
+ enum { init, isopen, quit } con_state;
int fd_ctrl;
int addrtype;
char *host;
OpenPOWER on IntegriCloud