]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
fixup the cwdcount bagder/ftp-rawpath 18312/head
authorDaniel Stenberg <daniel@haxx.se>
Mon, 18 Aug 2025 20:28:29 +0000 (22:28 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 18 Aug 2025 20:28:29 +0000 (22:28 +0200)
lib/ftp.c

index 3e04db92bd440324c646cc583adf6b37eb4c7900..1da756b9dcaf34797e72a365b001243998ed5d4a 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3081,13 +3081,15 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
       else {
         /* success */
         ftpc->count2 = 0;
-        if(++ftpc->cwdcount <= ftpc->dirdepth)
+        if(ftpc->cwdcount >= ftpc->dirdepth)
+          result = ftp_state_mdtm(data, ftpc, ftp);
+        else {
+          ftpc->cwdcount++;
           /* send next CWD */
           result = Curl_pp_sendf(data, &ftpc->pp, "CWD %.*s",
                                  pathlen(ftpc, ftpc->cwdcount - 1),
                                  pathpiece(ftpc, ftpc->cwdcount - 1));
-        else
-          result = ftp_state_mdtm(data, ftpc, ftp);
+        }
       }
       break;