1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +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.
*/
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.