~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Weaken the assertion in general_textout(). It was failing in the
[sgt/putty]
/
psftp.c
diff --git
a/psftp.c
b/psftp.c
index
990bc07
..
fe01b1a
100644
(file)
--- a/
psftp.c
+++ b/
psftp.c
@@
-411,14
+411,15
@@
int sftp_get_file(char *fname, char *outfname, int recurse, int restart)
if (restart) {
char decbuf[30];
if (seek_file(file, uint64_make(0,0) , FROM_END) == -1) {
if (restart) {
char decbuf[30];
if (seek_file(file, uint64_make(0,0) , FROM_END) == -1) {
+ close_wfile(file);
printf("reget: cannot restart %s - file too large\n",
outfname);
printf("reget: cannot restart %s - file too large\n",
outfname);
-
sftp_register(req = fxp_close_send(fh));
-
rreq = sftp_find_request(pktin = sftp_recv());
-
assert(rreq == req);
-
fxp_close_recv(pktin, rreq);
+ sftp_register(req = fxp_close_send(fh));
+ rreq = sftp_find_request(pktin = sftp_recv());
+ assert(rreq == req);
+ fxp_close_recv(pktin, rreq);
-
return 0;
+ return 0;
}
offset = get_file_posn(file);
}
offset = get_file_posn(file);
@@
-643,6
+644,7
@@
int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
fh = fxp_open_recv(pktin, rreq);
if (!fh) {
fh = fxp_open_recv(pktin, rreq);
if (!fh) {
+ close_rfile(file);
printf("%s: open for write: %s\n", outfname, fxp_error());
return 0;
}
printf("%s: open for write: %s\n", outfname, fxp_error());
return 0;
}
@@
-658,10
+660,12
@@
int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
ret = fxp_fstat_recv(pktin, rreq, &attrs);
if (!ret) {
ret = fxp_fstat_recv(pktin, rreq, &attrs);
if (!ret) {
+ close_rfile(file);
printf("read size of %s: %s\n", outfname, fxp_error());
return 0;
}
if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
printf("read size of %s: %s\n", outfname, fxp_error());
return 0;
}
if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
+ close_rfile(file);
printf("read size of %s: size was not given\n", outfname);
return 0;
}
printf("read size of %s: size was not given\n", outfname);
return 0;
}
@@
-703,7
+707,7
@@
int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
if (!xfer_done(xfer)) {
pktin = sftp_recv();
ret = xfer_upload_gotpkt(xfer, pktin);
if (!xfer_done(xfer)) {
pktin = sftp_recv();
ret = xfer_upload_gotpkt(xfer, pktin);
- if (
!ret
) {
+ if (
ret <= 0 && !err
) {
printf("error while writing: %s\n", fxp_error());
err = 1;
}
printf("error while writing: %s\n", fxp_error());
err = 1;
}
@@
-2236,6
+2240,11
@@
struct sftp_command *sftp_getcmd(FILE *fp, int mode, int modeflags)
cmd->words = sresize(cmd->words, cmd->wordssize, char *);
cmd->words[0] = dupstr("!");
cmd->words[1] = dupstr(p+1);
cmd->words = sresize(cmd->words, cmd->wordssize, char *);
cmd->words[0] = dupstr("!");
cmd->words[1] = dupstr(p+1);
+ } else if (*p == '#') {
+ /*
+ * Special case: comment. Entire line is ignored.
+ */
+ cmd->nwords = cmd->wordssize = 0;
} else {
/*
} else {
/*
@@
-2794,6
+2803,8
@@
static int psftp_connect(char *userhost, char *user, int portnumber)
back->provide_logctx(backhandle, logctx);
console_provide_logctx(logctx);
while (!back->sendok(backhandle)) {
back->provide_logctx(backhandle, logctx);
console_provide_logctx(logctx);
while (!back->sendok(backhandle)) {
+ if (back->exitcode(backhandle) >= 0)
+ return 1;
if (ssh_sftp_loop_iteration() < 0) {
fprintf(stderr, "ssh_init: error during SSH connection setup\n");
return 1;
if (ssh_sftp_loop_iteration() < 0) {
fprintf(stderr, "ssh_init: error during SSH connection setup\n");
return 1;