X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/ff2ae36762dccc463baba86bf9d39de1a57a70e1..02105c79d5cbe02d41294d7eeeb603b94706bbcc:/scp.c diff --git a/scp.c b/scp.c index 60ca11cb..3527f2b1 100644 --- a/scp.c +++ b/scp.c @@ -210,7 +210,7 @@ void fatalbox(char *fmt, ...) 0 /*lParam */ ))SleepEx(1000, TRUE); } - exit(1); + cleanup_exit(1); } void connection_fatal(char *fmt, ...) { @@ -233,7 +233,7 @@ void connection_fatal(char *fmt, ...) 0 /*lParam */ ))SleepEx(1000, TRUE); } - exit(1); + cleanup_exit(1); } /* @@ -268,6 +268,8 @@ int from_backend(int is_stderr, char *data, int datalen) unsigned char *p = (unsigned char *) data; unsigned len = (unsigned) datalen; + assert(len > 0); + /* * stderr data is just spouted to local stderr and otherwise * ignored. @@ -402,7 +404,7 @@ static void bump(char *fmt, ...) 0 /*lParam */ ))SleepEx(1000, TRUE); } - exit(1); + cleanup_exit(1); } /* @@ -746,6 +748,12 @@ void scp_source_setup(char *target, int shouldbedir) */ struct fxp_attrs attrs; + if (!fxp_init()) { + tell_user(stderr, "unable to initialise SFTP: %s", fxp_error()); + errs++; + return 1; + } + if (!fxp_stat(target, &attrs) || !(attrs.flags & SSH_FILEXFER_ATTR_PERMISSIONS)) scp_sftp_targetisdir = 0; @@ -957,6 +965,12 @@ int scp_sink_setup(char *source, int preserve, int recursive) { if (using_sftp) { char *newsource; + + if (!fxp_init()) { + tell_user(stderr, "unable to initialise SFTP: %s", fxp_error()); + errs++; + return 1; + } /* * It's possible that the source string we've been given * contains a wildcard. If so, we must split the directory @@ -2053,7 +2067,7 @@ static void usage(void) printf (" -gui hWnd GUI mode with the windows handle for receiving messages\n"); #endif - exit(1); + cleanup_exit(1); } /*