Skip to content

Commit

Permalink
Replace assert with an error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 2dfa47e commit 97f8328
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/XrdFileCache/XrdFileCacheFile.cc
Expand Up @@ -236,13 +236,18 @@ bool File::Open()
struct stat infoStat;
bool fileExisted = (Cache::GetInstance().GetOss()->Stat(ifn.c_str(), &infoStat) == XrdOssOK);

// AMT: the folowing below is a sanity check, it is not expected to happen. Could be an assert
if (fileExisted && (infoStat.st_size == 0)) {
TRACEF(Error, "File::Open() info file stored zero data file size");
return false;
}

if (m_output_fs.Create(Cache::GetInstance().RefConfiguration().m_username.c_str(), ifn.c_str(), 0600, myEnv, XRDOSS_mkpath) != XrdOssOK)
{
TRACEF(Error, "File::Open() can't create info file, " << strerror(errno));
return false;
}
m_infoFile = m_output_fs.newFile(Cache::GetInstance().RefConfiguration().m_username.c_str());
if (fileExisted) assert(infoStat.st_size > 0);
if (m_infoFile->Open(ifn.c_str(), O_RDWR, 0600, myEnv) != XrdOssOK)
{
TRACEF(Error, "File::Open() can't get FD info file, " << strerror(errno));
Expand Down

0 comments on commit 97f8328

Please sign in to comment.