summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1996-11-14 09:51:47 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1996-11-14 09:51:47 +0000
commitdbf96d1210a68276a4afef5f5276d3c7e6e358f0 (patch)
tree743fd634de1111de9857601a8d68c17614975398 /lib
parentbbd3d24b96068fb416a7c2f820c481f20c486ebb (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libftpio/ftpio.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c
index 447d71a1d6a3..df8e659542a8 100644
--- a/lib/libftpio/ftpio.c
+++ b/lib/libftpio/ftpio.c
@@ -357,17 +357,25 @@ ftpPutURL(char *url, char *user, char *passwd, int *retcode)
{
char host[255], name[255];
int port;
- FILE *fp, *fp2;
+ static FILE *fp = NULL;
+ FILE *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 && retcode)
- *retcode = ftpErrno(fp);
- fclose(fp);
+ if (!fp2) {
+ if (retcode)
+ *retcode = ftpErrno(fp);
+ fclose(fp);
+ fp = NULL;
+ }
return fp2;
}
}