Skip to content

Commit

Permalink
[XrdCl] Add support for local file rm.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal authored and osschar committed Oct 10, 2019
1 parent 08f47d8 commit c7f1585
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/XrdCl/XrdClFileSystem.cc
Expand Up @@ -91,6 +91,25 @@ namespace
return QueueTask( new XRootDStatus(), resp, handler );
}

XrdCl::XRootDStatus Rm( const std::string &path,
XrdCl::ResponseHandler *handler,
uint16_t timeout )
{
using namespace XrdCl;

Log *log = DefaultEnv::GetLog();
if( unlink( path.c_str() ) )
{
log->Error( FileMsg, "Rm: failed: %s", strerror( errno ) );
XRootDStatus *error = new XRootDStatus( stError, errErrorResponse,
XProtocol::mapError( errno ),
strerror( errno ) );
return QueueTask( error, 0, handler );
}

return QueueTask( new XRootDStatus(), nullptr, handler );
}

static LocalFS& Instance()
{
static LocalFS instance;
Expand Down Expand Up @@ -1152,6 +1171,9 @@ namespace XrdCl
if( pPlugIn )
return pPlugIn->Rm( path, handler, timeout );

if( pUrl->IsLocalFile() )
return LocalFS::Instance().Rm( path, handler, timeout );

std::string fPath = FilterXrdClCgi( path );

Message *msg;
Expand Down

0 comments on commit c7f1585

Please sign in to comment.