diff options
author | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-18 18:10:35 +0000 |
---|---|---|
committer | Fumitoshi UKAI <ukai@debian.or.jp> | 2002-11-18 18:10:35 +0000 |
commit | 4f37c0a28c70aaa2c7cf8da0a3260b7431570c75 (patch) | |
tree | 87ed9ef8df8eed37256003d150d8bd5a406861b1 /ftp.c | |
parent | [w3m-dev 03449] Add DOWNLOAD_LIST to doc*/README.func and scripts/w3mhelp.cgi.in (diff) | |
download | w3m-4f37c0a28c70aaa2c7cf8da0a3260b7431570c75.tar.gz w3m-4f37c0a28c70aaa2c7cf8da0a3260b7431570c75.zip |
[w3m-dev 03444] download from ftp.
* file.c (FTPhalfclose: static
(loadGeneralFile): UFclose
FTPhalfclose for SCM_FTP
UFclose before signal back
(loadImageBuffer): UFclose before signal back
(openGeneralPagerBuffer): UFclose
* ftp.c (ftp_fclose): added
(Ftpfclose): dont read response(), but ftp_fclose()
(FtpBye): ftp_fclose()
From: Hironori SAKAMOTO <hsaka@mth.biglobe.ne.jp>
Diffstat (limited to '')
-rw-r--r-- | ftp.c | 43 |
1 files changed, 25 insertions, 18 deletions
@@ -1,4 +1,4 @@ -/* $Id: ftp.c,v 1.13 2002/10/30 17:21:42 ukai Exp $ */ +/* $Id: ftp.c,v 1.14 2002/11/18 18:12:35 ukai Exp $ */ #include <stdio.h> #include <pwd.h> #include <Str.h> @@ -249,6 +249,27 @@ ftp_pasv(FTP ftp) return 0; } +static int +ftp_fclose(FTP ftp) +{ + int control_closed = 0; + + if (ftp->rcontrol != NULL) { + fclose(ftp->rcontrol); + ftp->rcontrol = NULL; + control_closed = 1; + } + if (ftp->wcontrol != NULL) { + fclose(ftp->wcontrol); + ftp->wcontrol = NULL; + control_closed = 1; + } + if (control_closed && ftp->data != NULL) { + fclose(ftp->data); + ftp->data = NULL; + } +} + int FtpCwd(FTP ftp, char *path) { @@ -298,7 +319,7 @@ Ftpfclose(FILE * f) fclose(f); if (f == current_ftp->data) current_ftp->data = NULL; - read_response(current_ftp); + ftp_fclose(current_ftp); return 0; } @@ -346,7 +367,7 @@ int FtpBye(FTP ftp) { Str tmp; - int ret_val, control_closed; + int ret_val; fwrite("QUIT\r\n", 6, sizeof(char), ftp->wcontrol); fflush(ftp->wcontrol); @@ -355,21 +376,7 @@ FtpBye(FTP ftp) ret_val = -1; else ret_val = 0; - control_closed = 0; - if (ftp->rcontrol != NULL) { - fclose(ftp->rcontrol); - ftp->rcontrol = NULL; - control_closed = 1; - } - if (ftp->wcontrol != NULL) { - fclose(ftp->wcontrol); - ftp->wcontrol = NULL; - control_closed = 1; - } - if (control_closed && ftp->data != NULL) { - fclose(ftp->data); - ftp->data = NULL; - } + ftp_fclose(ftp); return ret_val; } |