diff options
author | ache <ache@FreeBSD.org> | 1996-11-14 09:44:09 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1996-11-14 09:44:09 +0000 |
commit | a48acddc8fb03f1dae5c0e555514f1d7e1c879c7 (patch) | |
tree | 2d90ecdb7c0d7f5004533c33d478b78beca6ec3d /lib/libftpio | |
parent | 15ab0f62afc28304dad2e833d74adb3733130766 (diff) | |
download | FreeBSD-src-a48acddc8fb03f1dae5c0e555514f1d7e1c879c7.zip FreeBSD-src-a48acddc8fb03f1dae5c0e555514f1d7e1c879c7.tar.gz |
Since ftpPutURL not use hostname cache, optimize it by always closing
connection at the end of operation, so it not leave opened
file without a reason.
Diffstat (limited to 'lib/libftpio')
-rw-r--r-- | lib/libftpio/ftpio.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c index 5df25b5..447d71a 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.17 1996/11/14 05:22:12 ache Exp $ + * $Id: ftpio.c,v 1.18 1996/11/14 06:59:39 ache Exp $ * */ @@ -357,25 +357,17 @@ ftpPutURL(char *url, char *user, char *passwd, int *retcode) { char host[255], name[255]; int port; - static FILE *fp = NULL; - FILE *fp2; + FILE *fp, *fp2; if (retcode) *retcode = 0; - if (fp) { /* Close previous managed connection */ - fclose(fp); - fp = NULL; - } if (get_url_info(url, host, &port, name) == SUCCESS) { fp = ftpLogin(host, user, passwd, port, 0, retcode); if (fp) { fp2 = ftpPut(fp, name); - if (!fp2) { - if (retcode) - *retcode = ftpErrno(fp); - fclose(fp); - fp = NULL; - } + if (!fp2 && retcode) + *retcode = ftpErrno(fp); + fclose(fp); return fp2; } } |