summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sftp-client.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sftp-client.c b/sftp-client.c
index 73e3c2f53..4fb618190 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.134 2019/07/12 03:56:21 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 *
@@ -1203,7 +1203,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1203 struct sshbuf *msg; 1203 struct sshbuf *msg;
1204 u_char *handle; 1204 u_char *handle;
1205 int local_fd = -1, write_error; 1205 int local_fd = -1, write_error;
1206 int read_error, write_errno, reordered = 0, r; 1206 int read_error, write_errno, lmodified = 0, reordered = 0, r;
1207 u_int64_t offset = 0, size, highwater; 1207 u_int64_t offset = 0, size, highwater;
1208 u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK; 1208 u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK;
1209 off_t progress_counter; 1209 off_t progress_counter;
@@ -1373,6 +1373,7 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1373 if (len > req->len) 1373 if (len > req->len)
1374 fatal("Received more data than asked for " 1374 fatal("Received more data than asked for "
1375 "%zu > %zu", len, req->len); 1375 "%zu > %zu", len, req->len);
1376 lmodified = 1;
1376 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || 1377 if ((lseek(local_fd, req->offset, SEEK_SET) == -1 ||
1377 atomicio(vwrite, local_fd, data, len) != len) && 1378 atomicio(vwrite, local_fd, data, len) != len) &&
1378 !write_error) { 1379 !write_error) {
@@ -1476,7 +1477,9 @@ do_download(struct sftp_conn *conn, const char *remote_path,
1476 error("Can't set times on \"%s\": %s", 1477 error("Can't set times on \"%s\": %s",
1477 local_path, strerror(errno)); 1478 local_path, strerror(errno));
1478 } 1479 }
1479 if (fsync_flag) { 1480 if (resume_flag && !lmodified)
1481 logit("File \"%s\" was not modified", local_path);
1482 else if (fsync_flag) {
1480 debug("syncing \"%s\"", local_path); 1483 debug("syncing \"%s\"", local_path);
1481 if (fsync(local_fd) == -1) 1484 if (fsync(local_fd) == -1)
1482 error("Couldn't sync file \"%s\": %s", 1485 error("Couldn't sync file \"%s\": %s",