Skip to content

Commit

Permalink
Merge pull request #13045 from davidlt/fix-xrootd-unused-return
Browse files Browse the repository at this point in the history
[RFC] Utilities/XrdAdaptor: fix -Wunused-result errors
  • Loading branch information
davidlange6 committed Jan 27, 2016
2 parents 516f419 + 7134e88 commit 1aabae2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
8 changes: 7 additions & 1 deletion Utilities/XrdAdaptor/plugins/XrdStorageMaker.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/ServiceRegistry/interface/ServiceMaker.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "Utilities/StorageFactory/interface/StorageMaker.h"
#include "Utilities/StorageFactory/interface/StorageMakerFactory.h"
Expand Down Expand Up @@ -83,7 +84,12 @@ class XrdStorageMaker final : public StorageMaker
XrdCl::URL url(fullpath);
XrdCl::FileSystem fs(url);
std::vector<std::string> fileList; fileList.push_back(url.GetPath());
fs.Prepare(fileList, XrdCl::PrepareFlags::Stage, 0, &m_null_handler);
auto status = fs.Prepare(fileList, XrdCl::PrepareFlags::Stage, 0, &m_null_handler);
if (!status.IsOK())
{
edm::LogWarning("StageInError") << "XrdCl::FileSystem::Prepare failed with error '"
<< status.ToStr() << "' (errNo = " << status.errNo << ")";
}
}

virtual bool check (const std::string &proto,
Expand Down
5 changes: 4 additions & 1 deletion Utilities/XrdAdaptor/src/XrdRequestManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ SendMonitoringInfo(XrdCl::File &file)
{
XrdCl::URL url(lastUrl);
XrdCl::FileSystem fs(url);
fs.SendInfo(jobId, &nullHandler, 30);
if (!(fs.SendInfo(jobId, &nullHandler, 30).IsOK()))
{
edm::LogWarning("XrdAdaptorInternal") << "Failed to send the monitoring information, monitoring ID is " << jobId << ".";
}
edm::LogInfo("XrdAdaptorInternal") << "Set monitoring ID to " << jobId << ".";
}
}
Expand Down
16 changes: 14 additions & 2 deletions Utilities/XrdAdaptor/src/XrdSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "XrdCl/XrdClFile.hh"

#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "XrdSource.h"
Expand Down Expand Up @@ -321,10 +322,12 @@ Source::handle(std::shared_ptr<ClientRequest> c)
#ifdef XRD_FAKE_SLOW
if (m_slow) std::this_thread::sleep_for(std::chrono::milliseconds(XRD_DELAY));
#endif

XrdCl::XRootDStatus status;
if (c->m_into)
{
// See notes in ClientRequest definition to understand this voodoo.
m_fh->Read(c->m_off, c->m_size, c->m_into, c.get());
status = m_fh->Read(c->m_off, c->m_size, c->m_into, c.get());
}
else
{
Expand All @@ -335,7 +338,16 @@ Source::handle(std::shared_ptr<ClientRequest> c)
cl.emplace_back(it.offset(), it.size(), it.data());
}
validateList(cl);
m_fh->VectorRead(cl, nullptr, c.get());
status = m_fh->VectorRead(cl, nullptr, c.get());
}

if (!status.IsOK())
{
edm::Exception ex(edm::errors::FileReadError);
ex << "XrdFile::Read or XrdFile::VectorRead failed with error: '"
<< status.ToStr() << "' (errNo = " << status.errNo << ")";
ex.addContext("Calling Source::handle");
throw ex;
}
}

0 comments on commit 1aabae2

Please sign in to comment.