summaryrefslogtreecommitdiff
path: root/sftp-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'sftp-client.c')
-rw-r--r--sftp-client.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 73e3c2f53..72f7fff7a 100644
--- a/sftp-client.c
+++ b/sftp-client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sftp-client.c,v 1.133 2019/01/24 16:52:17 dtucker Exp $ */ 1/* $OpenBSD: sftp-client.c,v 1.135 2019/10/04 04:31:59 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> 3 * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
4 * 4 *
@@ -631,8 +631,7 @@ do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag,
631 __func__, ssh_err(r)); 631 __func__, ssh_err(r));
632 free(filename); 632 free(filename);
633 free(longname); 633 free(longname);
634 sshbuf_free(msg); 634 goto out;
635 return -1;
636 } 635 }
637 636
638 if (print_flag) 637 if (print_flag)
@@ -1203,7 +1202,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1203 struct sshbuf *msg; 1202 struct sshbuf *msg;
1204 u_char *handle; 1203 u_char *handle;
1205 int local_fd = -1, write_error; 1204 int local_fd = -1, write_error;
1206 int read_error, write_errno, reordered = 0, r; 1205 int read_error, write_errno, lmodified = 0, reordered = 0, r;
1207 u_int64_t offset = 0, size, highwater; 1206 u_int64_t offset = 0, size, highwater;
1208 u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK; 1207 u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK;
1209 off_t progress_counter; 1208 off_t progress_counter;
@@ -1373,6 +1372,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1373 if (len > req->len) 1372 if (len > req->len)
1374 fatal("Received more data than asked for " 1373 fatal("Received more data than asked for "
1375 "%zu > %zu", len, req->len); 1374 "%zu > %zu", len, req->len);
1375 lmodified = 1;
1376 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || 1376 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
1377 atomicio(vwrite, local_fd, data, len) != len) && 1377 atomicio(vwrite, local_fd, data, len) != len) &&
1378 !write_error) { 1378 !write_error) {
@@ -1476,7 +1476,9 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1476 error("Can't set times on \"%s\": %s", 1476 error("Can't set times on \"%s\": %s",
1477 local_path, strerror(errno)); 1477 local_path, strerror(errno));
1478 } 1478 }
1479 if (fsync_flag) { 1479 if (resume_flag && !lmodified)
1480 logit("File \"%s\" was not modified", local_path);
1481 else if (fsync_flag) {
1480 debug("syncing \"%s\"", local_path); 1482 debug("syncing \"%s\"", local_path);
1481 if (fsync(local_fd) == -1) 1483 if (fsync(local_fd) == -1)
1482 error("Couldn't sync file \"%s\": %s", 1484 error("Couldn't sync file \"%s\": %s",