mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 09:12:24 +00:00
Merge branch 'pre-0.64'
This commit is contained in:
commit
23208779e7
9
psftp.c
9
psftp.c
@ -668,21 +668,19 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
|
|||||||
if (restart) {
|
if (restart) {
|
||||||
char decbuf[30];
|
char decbuf[30];
|
||||||
struct fxp_attrs attrs;
|
struct fxp_attrs attrs;
|
||||||
int ret;
|
|
||||||
|
|
||||||
req = fxp_fstat_send(fh);
|
req = fxp_fstat_send(fh);
|
||||||
pktin = sftp_wait_for_reply(req);
|
pktin = sftp_wait_for_reply(req);
|
||||||
ret = fxp_fstat_recv(pktin, req, &attrs);
|
ret = fxp_fstat_recv(pktin, req, &attrs);
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
close_rfile(file);
|
|
||||||
printf("read size of %s: %s\n", outfname, fxp_error());
|
printf("read size of %s: %s\n", outfname, fxp_error());
|
||||||
return 0;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
|
if (!(attrs.flags & SSH_FILEXFER_ATTR_SIZE)) {
|
||||||
close_rfile(file);
|
|
||||||
printf("read size of %s: size was not given\n", outfname);
|
printf("read size of %s: size was not given\n", outfname);
|
||||||
return 0;
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
offset = attrs.size;
|
offset = attrs.size;
|
||||||
uint64_decimal(offset, decbuf);
|
uint64_decimal(offset, decbuf);
|
||||||
@ -735,6 +733,7 @@ int sftp_put_file(char *fname, char *outfname, int recurse, int restart)
|
|||||||
|
|
||||||
xfer_cleanup(xfer);
|
xfer_cleanup(xfer);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
req = fxp_close_send(fh);
|
req = fxp_close_send(fh);
|
||||||
pktin = sftp_wait_for_reply(req);
|
pktin = sftp_wait_for_reply(req);
|
||||||
fxp_close_recv(pktin, req);
|
fxp_close_recv(pktin, req);
|
||||||
|
@ -780,7 +780,7 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
|
|||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
#ifndef NO_IPV6
|
#ifndef NO_IPV6
|
||||||
struct addrinfo hints, *ai;
|
struct addrinfo hints, *ai = NULL;
|
||||||
char portstr[6];
|
char portstr[6];
|
||||||
#endif
|
#endif
|
||||||
union sockaddr_union u;
|
union sockaddr_union u;
|
||||||
@ -926,6 +926,12 @@ Socket sk_newlistener(char *srcaddr, int port, Plug plug, int local_host_only, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
retcode = bind(s, &addr->sa, addrlen);
|
retcode = bind(s, &addr->sa, addrlen);
|
||||||
|
|
||||||
|
#ifndef NO_IPV6
|
||||||
|
if (ai)
|
||||||
|
freeaddrinfo(ai);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (retcode < 0) {
|
if (retcode < 0) {
|
||||||
close(s);
|
close(s);
|
||||||
ret->error = strerror(errno);
|
ret->error = strerror(errno);
|
||||||
|
@ -696,6 +696,7 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
|
|||||||
int ret;
|
int ret;
|
||||||
struct command_read_ctx actx, *ctx = &actx;
|
struct command_read_ctx actx, *ctx = &actx;
|
||||||
DWORD threadid;
|
DWORD threadid;
|
||||||
|
HANDLE hThread;
|
||||||
|
|
||||||
fputs(prompt, stdout);
|
fputs(prompt, stdout);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
@ -712,8 +713,9 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
|
|||||||
ctx->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
ctx->event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
ctx->line = NULL;
|
ctx->line = NULL;
|
||||||
|
|
||||||
if (!CreateThread(NULL, 0, command_read_thread,
|
hThread = CreateThread(NULL, 0, command_read_thread, ctx, 0, &threadid);
|
||||||
ctx, 0, &threadid)) {
|
if (!hThread) {
|
||||||
|
CloseHandle(ctx->event);
|
||||||
fprintf(stderr, "Unable to create command input thread\n");
|
fprintf(stderr, "Unable to create command input thread\n");
|
||||||
cleanup_exit(1);
|
cleanup_exit(1);
|
||||||
}
|
}
|
||||||
@ -725,6 +727,9 @@ char *ssh_sftp_get_cmdline(char *prompt, int no_fds_ok)
|
|||||||
assert(ret >= 0);
|
assert(ret >= 0);
|
||||||
} while (ret == 0);
|
} while (ret == 0);
|
||||||
|
|
||||||
|
CloseHandle(hThread);
|
||||||
|
CloseHandle(ctx->event);
|
||||||
|
|
||||||
return ctx->line;
|
return ctx->line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user