1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

When the comments say `if we're in restart mode', the code in

question should actually be conditional on restart mode!

[originally from svn r7438]
This commit is contained in:
Simon Tatham 2007-04-02 08:44:00 +00:00
parent 5f410ef051
commit 0a3c07d15e

68
psftp.c
View File

@ -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. * If none of them exists, of course, we start at 0.
*/ */
i = 0; i = 0;
while (i < nnames) { if (restart) {
char *nextoutfname; while (i < nnames) {
int ret; char *nextoutfname;
if (outfname) int ret;
nextoutfname = dir_file_cat(outfname, if (outfname)
ournames[i]->filename); nextoutfname = dir_file_cat(outfname,
else ournames[i]->filename);
nextoutfname = dupstr(ournames[i]->filename); else
ret = (file_type(nextoutfname) == FILE_TYPE_NONEXISTENT); nextoutfname = dupstr(ournames[i]->filename);
sfree(nextoutfname); ret = (file_type(nextoutfname) == FILE_TYPE_NONEXISTENT);
if (ret) sfree(nextoutfname);
break; if (ret)
i++; break;
} i++;
if (i > 0) }
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]
@ -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. * If none of them exists, of course, we start at 0.
*/ */
i = 0; i = 0;
while (i < nnames) { if (restart) {
char *nextoutfname; while (i < nnames) {
nextoutfname = dupcat(outfname, "/", ournames[i], NULL); char *nextoutfname;
sftp_register(req = fxp_stat_send(nextoutfname)); nextoutfname = dupcat(outfname, "/", ournames[i], NULL);
rreq = sftp_find_request(pktin = sftp_recv()); sftp_register(req = fxp_stat_send(nextoutfname));
assert(rreq == req); rreq = sftp_find_request(pktin = sftp_recv());
result = fxp_stat_recv(pktin, rreq, &attrs); assert(rreq == req);
sfree(nextoutfname); result = fxp_stat_recv(pktin, rreq, &attrs);
if (!result) sfree(nextoutfname);
break; if (!result)
i++; break;
} i++;
if (i > 0) }
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 * and continuing on to the end of the list, we
* construct a new source and target file name, and * construct a new source and target file name, and
* call sftp_put_file again. * call sftp_put_file again.