When the comments say `if we're in restart mode', the code in
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 2 Apr 2007 08:44:00 +0000 (08:44 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Mon, 2 Apr 2007 08:44:00 +0000 (08:44 +0000)
question should actually be conditional on restart mode!

git-svn-id: svn://svn.tartarus.org/sgt/putty@7438 cda61777-01e9-0310-a592-d414129be87e

psftp.c

diff --git a/psftp.c b/psftp.c
index f77a88e..f8a2240 100644 (file)
--- a/psftp.c
+++ b/psftp.c
@@ -321,22 +321,24 @@ int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
             * If none of them exists, of course, we start at 0.
             */
            i = 0;
-           while (i < nnames) {
-               char *nextoutfname;
-               int ret;
-               if (outfname)
-                   nextoutfname = dir_file_cat(outfname,
-                                               ournames[i]->filename);
-               else
-                   nextoutfname = dupstr(ournames[i]->filename);
-               ret = (file_type(nextoutfname) == FILE_TYPE_NONEXISTENT);
-               sfree(nextoutfname);
-               if (ret)
-                   break;
-               i++;
-           }
-           if (i > 0)
-               i--;
+            if (restart) {
+                while (i < nnames) {
+                    char *nextoutfname;
+                    int ret;
+                    if (outfname)
+                        nextoutfname = dir_file_cat(outfname,
+                                                    ournames[i]->filename);
+                    else
+                        nextoutfname = dupstr(ournames[i]->filename);
+                    ret = (file_type(nextoutfname) == FILE_TYPE_NONEXISTENT);
+                    sfree(nextoutfname);
+                    if (ret)
+                        break;
+                    i++;
+                }
+                if (i > 0)
+                    i--;
+            }
 
            /*
             * Now we're ready to recurse. Starting at ournames[i]
@@ -568,23 +570,25 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
         * If none of them exists, of course, we start at 0.
         */
        i = 0;
-       while (i < nnames) {
-           char *nextoutfname;
-           nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
-           sftp_register(req = fxp_stat_send(nextoutfname));
-           rreq = sftp_find_request(pktin = sftp_recv());
-           assert(rreq == req);
-           result = fxp_stat_recv(pktin, rreq, &attrs);
-           sfree(nextoutfname);
-           if (!result)
-               break;
-           i++;
-       }
-       if (i > 0)
-           i--;
+        if (restart) {
+            while (i < nnames) {
+                char *nextoutfname;
+                nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
+                sftp_register(req = fxp_stat_send(nextoutfname));
+                rreq = sftp_find_request(pktin = sftp_recv());
+                assert(rreq == req);
+                result = fxp_stat_recv(pktin, rreq, &attrs);
+                sfree(nextoutfname);
+                if (!result)
+                    break;
+                i++;
+            }
+            if (i > 0)
+                i--;
+        }
 
-       /*
-        * Now we're ready to recurse. Starting at ournames[i]
+        /*
+         * Now we're ready to recurse. Starting at ournames[i]
         * and continuing on to the end of the list, we
         * construct a new source and target file name, and
         * call sftp_put_file again.