summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1996-06-17 23:16:04 +0000
committerjkh <jkh@FreeBSD.org>1996-06-17 23:16:04 +0000
commit6690bcda709953408fcf2f24238427f76b273169 (patch)
tree1e3f0ff4c836c78e71a13e613df0b96710dc6ebe /lib
parentcdc8a8df5449322c1bfdce74eda83aeb3f0d667a (diff)
downloadFreeBSD-src-6690bcda709953408fcf2f24238427f76b273169.zip
FreeBSD-src-6690bcda709953408fcf2f24238427f76b273169.tar.gz
Manage control connections a little better for the URL routines.
This will do as a stop-gap until I figure out a more fault-tolerant way of having deferred closes against the control connection work without blocking.
Diffstat (limited to 'lib')
-rw-r--r--lib/libftpio/ftpio.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c
index da451b8..bfc3a66 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.4 1996/06/17 20:36:57 jkh Exp $
+ * $Id: ftpio.c,v 1.5 1996/06/17 22:10:15 jkh Exp $
*
*/
@@ -238,13 +238,17 @@ ftpGetURL(char *url, char *user, char *passwd)
{
char host[255], name[255];
int port;
- FILE *fp, *fp2;
+ static FILE *fp = NULL;
+ FILE *fp2;
+ 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);
if (fp) {
fp2 = ftpGet(fp, name, NULL);
- fclose(fp);
return fp2;
}
}
@@ -256,13 +260,17 @@ ftpPutURL(char *url, char *user, char *passwd)
{
char host[255], name[255];
int port;
- FILE *fp, *fp2;
+ static FILE *fp = NULL;
+ FILE *fp2;
+ 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);
if (fp) {
fp2 = ftpPut(fp, name);
- fclose(fp);
return fp2;
}
}
OpenPOWER on IntegriCloud