diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2019-07-12 03:56:22 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2019-07-12 03:56:22 +0000 |
commit | 256b376b1b8fd35b82e3c618663c0dad45500cff (patch) | |
tree | 56e96decfdf3f1eaef262948f229a8dde53dabad /usr.bin/ssh | |
parent | 0cdda11afb8c8723f3f7f9a46617e56310362333 (diff) |
print explicit "not modified" message if a file was requested for
resumed download but was considered already complete.
bz#2978 ok dtucker
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/sftp-client.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/ssh/sftp-client.c b/usr.bin/ssh/sftp-client.c index aeaa7d1a997..2fba16acea9 100644 --- a/usr.bin/ssh/sftp-client.c +++ b/usr.bin/ssh/sftp-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sftp-client.c,v 1.133 2019/01/24 16:52:17 dtucker Exp $ */ +/* $OpenBSD: sftp-client.c,v 1.134 2019/07/12 03:56:21 djm Exp $ */ /* * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org> * @@ -1189,7 +1189,7 @@ do_download(struct sftp_conn *conn, const char *remote_path, struct sshbuf *msg; u_char *handle; int local_fd = -1, write_error; - int read_error, write_errno, reordered = 0, r; + int read_error, write_errno, lmodified = 0, reordered = 0, r; u_int64_t offset = 0, size, highwater; u_int mode, id, buflen, num_req, max_req, status = SSH2_FX_OK; off_t progress_counter; @@ -1359,6 +1359,7 @@ do_download(struct sftp_conn *conn, const char *remote_path, if (len > req->len) fatal("Received more data than asked for " "%zu > %zu", len, req->len); + lmodified = 1; if ((lseek(local_fd, req->offset, SEEK_SET) == -1 || atomicio(vwrite, local_fd, data, len) != len) && !write_error) { @@ -1458,7 +1459,9 @@ do_download(struct sftp_conn *conn, const char *remote_path, error("Can't set times on \"%s\": %s", local_path, strerror(errno)); } - if (fsync_flag) { + if (resume_flag && !lmodified) + logit("File \"%s\" was not modified", local_path); + else if (fsync_flag) { debug("syncing \"%s\"", local_path); if (fsync(local_fd) == -1) error("Couldn't sync file \"%s\": %s", |