summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Young <youngr225@gmail.com>2021-11-08 12:20:23 -0600
committerDaniel Stenberg <daniel@haxx.se>2021-11-08 23:05:12 +0100
commitef99e24886a3a88332121faaa210be2487508a48 (patch)
tree3cf9b10b988519cf73ade5a5e5a0ac2b43003700
parent351b1817401f91e168517f87106f6cf495288c88 (diff)
downloadcurl-ef99e24886a3a88332121faaa210be2487508a48.tar.gz
ftp: make the MKD retry to retry once per directory
Reported-by: Roger Young Fixes #7967 Closes #7976
-rw-r--r--lib/ftp.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 0b9c9b732..a8d209e3f 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -876,11 +876,6 @@ static CURLcode ftp_state_cwd(struct Curl_easy *data,
ftpc->count2 = 0; /* count2 counts failed CWDs */
- /* count3 is set to allow a MKD to fail once. In the case when first CWD
- fails and then MKD fails (due to another session raced it to create the
- dir) this then allows for a second try to CWD to it */
- ftpc->count3 = (data->set.ftp_create_missing_dirs == 2)?1:0;
-
if(conn->bits.reuse && ftpc->entrypath &&
/* no need to go to entrypath when we have an absolute path */
!(ftpc->dirdepth && ftpc->dirs[0][0] == '/')) {
@@ -3002,6 +2997,12 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
ftpc->cwdcount && !ftpc->count2) {
/* try making it */
ftpc->count2++; /* counter to prevent CWD-MKD loops */
+
+ /* count3 is set to allow MKD to fail once per dir. In the case when
+ CWD fails and then MKD fails (due to another session raced it to
+ create the dir) this then allows for a second try to CWD to it. */
+ ftpc->count3 = (data->set.ftp_create_missing_dirs == 2) ? 1 : 0;
+
result = Curl_pp_sendf(data, &ftpc->pp, "MKD %s",
ftpc->dirs[ftpc->cwdcount - 1]);
if(!result)