[openssh-commits] [openssh] 02/02: upstream: print explicit "not modified" message if a file was

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jul 12 14:07:39 AEST 2019


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit a0876bd994cab9ba6e47ba2a163a4417c7597487
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Fri Jul 12 03:56:21 2019 +0000

    upstream: print explicit "not modified" message if a file was
    
    requested for resumed download but was considered already complete.
    
    bz#2978 ok dtucker
    
    OpenBSD-Commit-ID: f32084b26a662f16215ee4ca4a403d67e49ab986
---
 sftp-client.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sftp-client.c b/sftp-client.c
index 73e3c2f5..4fb61819 100644
--- a/sftp-client.c
+++ b/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 at openbsd.org>
  *
@@ -1203,7 +1203,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;
@@ -1373,6 +1373,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) {
@@ -1476,7 +1477,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",

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list