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
This commit is contained in:
parent
b9b0f2ac96
commit
a0876bd994
|
@ -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>
|
||||
*
|
||||
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue