Skip to content

Commit

Permalink
[XrdCl] fix copying to stdout (bug introduced in a497919)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed May 25, 2018
1 parent a63f06a commit dec6792
Showing 1 changed file with 40 additions and 37 deletions.
77 changes: 40 additions & 37 deletions src/XrdCl/XrdClCopyProcess.cc
Expand Up @@ -291,47 +291,50 @@ namespace XrdCl
if( !target.IsValid() )
return XRootDStatus( stError, errInvalidArgs, 0, "invalid target" );

// handle directories
FileSystem fs( target );
StatInfo *infoptr = 0;
XRootDStatus st = fs.Stat( target.GetPath(), infoptr );

if( !st.IsOK() )
{
if( st.code != errNotFound && st.errNo != kXR_NotFound )
return st;
}
else
if( target.GetProtocol() != "stdio" )
{
std::unique_ptr<StatInfo> info( infoptr );
if( info->TestFlags( StatInfo::IsDir) )
{
std::string path = target.GetPath() + '/';
std::string fn;
// handle directories
FileSystem fs( target );
StatInfo *infoptr = 0;
XRootDStatus st = fs.Stat( target.GetPath(), infoptr );

bool isZip = false;
props.Get( "zipArchive", isZip );
if( isZip )
{
props.Get( "zipSource", fn );
}
else if( source.IsMetalink() )
{
RedirectorRegistry &registry = XrdCl::RedirectorRegistry::Instance();
VirtualRedirector *redirector = registry.Get( source );
fn = redirector->GetTargetName();
}
else
if( !st.IsOK() )
{
if( st.code != errNotFound && st.errNo != kXR_NotFound )
return st;
}
else
{
std::unique_ptr<StatInfo> info( infoptr );
if( info->TestFlags( StatInfo::IsDir) )
{
fn = source.GetPath();
std::string path = target.GetPath() + '/';
std::string fn;

bool isZip = false;
props.Get( "zipArchive", isZip );
if( isZip )
{
props.Get( "zipSource", fn );
}
else if( source.IsMetalink() )
{
RedirectorRegistry &registry = XrdCl::RedirectorRegistry::Instance();
VirtualRedirector *redirector = registry.Get( source );
fn = redirector->GetTargetName();
}
else
{
fn = source.GetPath();
}

size_t pos = fn.rfind( '/' );
if( pos != std::string::npos )
fn = fn.substr( pos + 1 );
path += fn;
target.SetPath( path );
props.Set( "target", target.GetURL() );
}

size_t pos = fn.rfind( '/' );
if( pos != std::string::npos )
fn = fn.substr( pos + 1 );
path += fn;
target.SetPath( path );
props.Set( "target", target.GetURL() );
}
}

Expand Down

0 comments on commit dec6792

Please sign in to comment.