Projects
Eulaceura:Mainline:GA
lftp
_service:obs_scm:backport-fix-second-find_cmd-S...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:backport-fix-second-find_cmd-Segmentation-fault.patch of Package lftp
From 0ead378c8a19d4c7b86e35265a7f6e878fd63c0d Mon Sep 17 00:00:00 2001 From: "Alexander V. Lukyanov" <lavv17@gmail.com> Date: Wed, 20 Apr 2022 23:32:37 +0300 Subject: [PATCH] fix second find_cmd Segmentation fault Conflict:NA Reference:https://github.com/lavv17/lftp/commit/0ead378c8a19d4c7b86e35265a7f6e878fd63c0d --- src/GetFileInfo.cc | 34 +++++++++++++++++++++++----------- src/GetFileInfo.h | 2 ++ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/GetFileInfo.cc b/src/GetFileInfo.cc index 7afb3d8..4d08dfa 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, "/")) @@ -390,6 +398,10 @@ int GetFileInfo::Do() * also serves as a last attempt to see if the file exists--we * only get here if everything else thinks the path doesn't exist. */ + + /* verify_fn_mabe null. */ + if(!verify_fn) + MakeVerifyFileName(); FileInfo *fi=new FileInfo(verify_fn); fi->need=need; /* We need to do at least one. */ diff --git a/src/GetFileInfo.h b/src/GetFileInfo.h index 1ac8f4d..483dcc3 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.23.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2