X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/51e7a01216be5a8198599b468bb7cc987aad9917..e91a8c3ff65ba7bc91d65940ed7c6cc7d6700f5f:/sftp-client.c diff --git a/sftp-client.c b/sftp-client.c index c71c66f3..42eb2b41 100644 --- a/sftp-client.c +++ b/sftp-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.64 2006/03/30 09:58:16 djm Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.75 2006/10/22 02:25:50 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller * @@ -23,16 +23,26 @@ #include "includes.h" #include +#include +#include "openbsd-compat/sys-queue.h" #ifdef HAVE_SYS_STAT_H # include #endif -# include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#include -#include "openbsd-compat/sys-queue.h" +#include +#include +#include +#include +#include +#include +#include -#include "buffer.h" -#include "bufaux.h" #include "xmalloc.h" +#include "buffer.h" #include "log.h" #include "atomicio.h" #include "progressmeter.h" @@ -61,16 +71,19 @@ static void send_msg(int fd, Buffer *m) { u_char mlen[4]; + struct iovec iov[2]; if (buffer_len(m) > SFTP_MAX_MSG_LENGTH) fatal("Outbound message too long %u", buffer_len(m)); /* Send length first */ put_u32(mlen, buffer_len(m)); - if (atomicio(vwrite, fd, mlen, sizeof(mlen)) != sizeof(mlen)) - fatal("Couldn't send packet: %s", strerror(errno)); + iov[0].iov_base = mlen; + iov[0].iov_len = sizeof(mlen); + iov[1].iov_base = buffer_ptr(m); + iov[1].iov_len = buffer_len(m); - if (atomicio(vwrite, fd, buffer_ptr(m), buffer_len(m)) != buffer_len(m)) + if (atomiciov(writev, fd, iov, 2) != buffer_len(m) + sizeof(mlen)) fatal("Couldn't send packet: %s", strerror(errno)); buffer_clear(m); @@ -1121,6 +1134,8 @@ do_upload(struct sftp_conn *conn, char *local_path, char *remote_path, if (status != SSH2_FX_OK) { error("Couldn't write to remote file \"%s\": %s", remote_path, fx2txt(status)); + if (showprogress) + stop_progress_meter(); do_close(conn, handle, handle_len); close(local_fd); xfree(data);