!11 bugfix: fix the bug of quiting while source file increased

From: @zengwefeng
Reviewed-by: @wangxp006
Signed-off-by: @wangxp006
This commit is contained in:
openeuler-ci-bot 2021-10-29 08:21:10 +00:00 committed by Gitee
commit cd37e0ae32
2 changed files with 67 additions and 2 deletions

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.9.1
Release: 3
Release: 4
License: GPLv3+
URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@ -9,7 +9,9 @@ BuildRequires: ncurses-devel, gnutls-devel, perl-generators, pkgconfig, gettext
BuildRequires: gettext readline-devel, zlib-devel, gcc-c++ desktop-file-utils
BuildRequires: chrpath
Requires: %{name}-help
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 +85,12 @@ echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arc
%changelog
* Fri Oct 29 2021 zengweifeng <zwfeng@huawei.com> - 4.9.1-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix bug of quiting while source file increased
* Mon Nov 09 2020 quanhongfei <quanhongfei@huawei.com> - 4.9.1-3
- Type:requirement
- ID:NA

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