!16 fill-verify_fn-in-case-of-cd-error-fix-650

From: @rimsky 
Reviewed-by: @kircher 
Signed-off-by: @kircher
This commit is contained in:
openeuler-ci-bot 2022-07-14 13:08:36 +00:00 committed by Gitee
commit 2b664263d6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 89 additions and 1 deletions

View File

@ -0,0 +1,81 @@
From 0ead378c8a19d4c7b86e35265a7f6e878fd63c0d Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Wed, 20 Apr 2022 23:32:37 +0300
Subject: [PATCH] fill verify_fn in case of cd error; fix #650
---
src/GetFileInfo.cc | 30 +++++++++++++++++++-----------
src/GetFileInfo.h | 2 ++
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/GetFileInfo.cc b/src/GetFileInfo.cc
index 7afb3d8f..b553544c 100644
--- a/src/GetFileInfo.cc
+++ b/src/GetFileInfo.cc
@@ -114,6 +114,22 @@ void GetFileInfo::PrepareToDie()
}
}
+void GetFileInfo::MakeVerifyFileName()
+{
+ /* Here we should have the home directory path. Find out
+ * the real name of the path. (We may have something like "~/..".) */
+
+ FileAccess::Path pwd(session->GetCwd());
+
+ session->SetCwd(origdir);
+ session->Chdir(dir, false);
+
+ verify_fn.set(basename_ptr(session->GetCwd()));
+
+ /* go back */
+ session->SetCwd(pwd);
+}
+
int GetFileInfo::Do()
{
int res;
@@ -241,6 +257,8 @@ int GetFileInfo::Do()
if(!saved_error_text)
saved_error_text.set(session->StrError(res));
session->Close();
+ if(!verify_fn)
+ MakeVerifyFileName();
if(res==FA::NO_FILE)
{
/* If this is a CWD to the parent, and it failed, we
@@ -262,17 +280,7 @@ int GetFileInfo::Do()
/* Now that we've connected, we should have the home directory path. Find out
* the real name of the path. (We may have something like "~/..".) */
if(!verify_fn)
- {
- FileAccess::Path pwd(session->GetCwd());
-
- session->SetCwd(origdir);
- session->Chdir(dir, false);
-
- verify_fn.set(basename_ptr(session->GetCwd()));
-
- /* go back */
- session->SetCwd(pwd);
- }
+ MakeVerifyFileName();
/* Special case: looking up "/". Make a phony entry. */
if(showdir && !strcmp(verify_fn, "/"))
diff --git a/src/GetFileInfo.h b/src/GetFileInfo.h
index 1ac8f4d2..483dcc33 100644
--- a/src/GetFileInfo.h
+++ b/src/GetFileInfo.h
@@ -66,6 +66,8 @@ class GetFileInfo : public ListInfo
void PrepareToDie();
+ void MakeVerifyFileName();
+
public:
GetFileInfo(const FileAccessRef& a, const char *path, bool showdir);
virtual ~GetFileInfo();
--
2.15.1.windows.2

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program Summary: A sophisticated file transfer program
Name: lftp Name: lftp
Version: 4.9.2 Version: 4.9.2
Release: 2 Release: 3
License: GPLv3+ License: GPLv3+
URL: http://lftp.yar.ru/ URL: http://lftp.yar.ru/
Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz Source0: http://lftp.yar.ru/ftp/%{name}-%{version}.tar.xz
@ -11,6 +11,7 @@ BuildRequires: chrpath
Patch0: lftp-4.0.9-date_fmt.patch Patch0: lftp-4.0.9-date_fmt.patch
Patch1: Quit-while-source-file-increased.patch Patch1: Quit-while-source-file-increased.patch
Patch2: backport-fill-verify_fn-in-case-of-cd-error-fix-650.patch
%description %description
LFTP is a sophisticated file transfer program supporting a number of LFTP is a sophisticated file transfer program supporting a number of
@ -84,6 +85,12 @@ echo "%{_libdir}/lftp/%{version}" > %{buildroot}/etc/ld.so.conf.d/%{name}-%{_arc
%changelog %changelog
* Thu Jul 14 2022 rimsky <349157738@qq.com> - 4.9.2-3
- Type:bugfix
- ID:NA
- SUG:NA
- DESC: fill verify_fn in case of cd error fix 650
* Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2 * Thu Oct 28 2021 zhouyihang <zhouyihang3@huawei.com> - 4.9.2-2
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA