From 76234c054054789986c9e67185e0e7855057fa99 Mon Sep 17 00:00:00 2001 From: Michal Simon Date: Mon, 29 Jun 2020 17:45:14 +0200 Subject: [PATCH] [XrdCl] Fix regression in recursive copy (introduced in f6723e00). Fixes #1227 --- src/XrdCl/XrdClCopy.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/XrdCl/XrdClCopy.cc b/src/XrdCl/XrdClCopy.cc index 5f99d6f50a3..6caeb3e8c70 100644 --- a/src/XrdCl/XrdClCopy.cc +++ b/src/XrdCl/XrdClCopy.cc @@ -707,7 +707,6 @@ int main( int argc, char **argv ) // If we're doing remote recursive copy, chain all the files (if it's a // directory) //---------------------------------------------------------------------------- - bool srcIsDir = config.srcFile->Protocol == XrdCpFile::isDir; if( config.Want( XrdCpConfig::DoRecurse ) && config.srcFile->Protocol == XrdCpFile::isXroot ) { @@ -718,7 +717,6 @@ int main( int argc, char **argv ) XRootDStatus st = fs->Stat( source.GetPath(), statInfo ); if( st.IsOK() && statInfo->TestFlags( StatInfo::IsDir ) ) { - srcIsDir = true; //------------------------------------------------------------------------ // Recursively index the remote directory //------------------------------------------------------------------------ @@ -779,6 +777,9 @@ int main( int argc, char **argv ) // Set up the job //-------------------------------------------------------------------------- std::string target = dest; + + // if the source was a file Dlen and Doff overlap + bool srcIsDir = std::string( sourceFile->Path ).size() == size_t( sourceFile->Doff + sourceFile->Dlen ); // if this is a recursive copy make sure we preserve the directory structure if( config.Want( XrdCpConfig::DoRecurse ) && srcIsDir ) {