Quit while source file increased

This commit is contained in:
sherlock2010 2021-10-28 18:55:15 +08:00
parent 73266c107d
commit 6c76cb8ff3
2 changed files with 66 additions and 2 deletions

View File

@ -0,0 +1,57 @@
From 3cabbf03f80e78a69a0b9e797050a1dacf5c26da Mon Sep 17 00:00:00 2001
From: sherlock2010 <15151851377@163.com>
Date: Thu, 28 Oct 2021 18:36:53 +0800
Subject: [PATCH] Quit while source file increased
---
src/FileCopy.cc | 7 +++++++
src/FileCopy.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/src/FileCopy.cc b/src/FileCopy.cc
index ead65a2..361958e 100644
--- a/src/FileCopy.cc
+++ b/src/FileCopy.cc
@@ -1137,6 +1137,7 @@ void FileCopyPeerFA::OpenSession()
debug((10,"copy dst: seek past eof (seek_pos=%lld, size=%lld)\n",
(long long)seek_pos,(long long)e_size));
eof=true;
+ fileincreased=true;
if(date==NO_DATE || date==NO_DATE_YET)
return;
}
@@ -1284,6 +1285,11 @@ int FileCopyPeerFA::Put_LL(const char *buf,int len)
if(session->IsClosed())
OpenSession();
+ if(fileincreased)
+ {
+ SetError(_("file size increased during transfer"));
+ return -1;
+ }
off_t io_at=pos; // GetRealPos can alter pos, save it.
if(GetRealPos()!=io_at)
return 0;
@@ -1352,6 +1358,7 @@ void FileCopyPeerFA::Init()
{
get_delay=0;
fxp=false;
+ fileincreased=false;
redirections=0;
can_seek=true;
can_seek0=true;
diff --git a/src/FileCopy.h b/src/FileCopy.h
index af97880..5a9e4cf 100644
--- a/src/FileCopy.h
+++ b/src/FileCopy.h
@@ -335,6 +335,7 @@ class FileCopyPeerFA : public FileCopyPeer
FileSet info;
bool fxp; // FXP (ftp<=>ftp copy) active
+ bool fileincreased;
UploadState upload_state;
int redirections;
--
1.8.3.1

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.9.2
Release: 1
Release: 2
License: GPLv3+
URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@ -9,7 +9,8 @@ BuildRequires: ncurses-devel, gnutls-devel, perl-generators, pkgconfig, gettext
BuildRequires: gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
BuildRequires: chrpath
Patch1: lftp-4.0.9-date_fmt.patch
Patch0: lftp-4.0.9-date_fmt.patch
Patch1: Quit-while-source-file-increased.patch
%description
LFTP is a sophisticated file transfer program supporting a number of
@ -83,6 +84,12 @@ echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arc
%changelog
* Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: quit while source file increased
* Fri Jan 29 2021 xihaochen <xihaochen@huawei.com> - 4.9.2-1
- Type:requirements
- Id:NA