Commit a4b87732 authored by Eric Cano's avatar Eric Cano
Browse files

Fixed file descriptor leak in unit test.

parent 09bf8783
......@@ -92,12 +92,4 @@ void cta::ArchiveJob::complete() {
//------------------------------------------------------------------------------
void cta::ArchiveJob::failed(const cta::exception::Exception &ex) {
m_dbJob->fail();
// TODO: callback on the client to signal the failure
}
//------------------------------------------------------------------------------
// retry
//------------------------------------------------------------------------------
void cta::ArchiveJob::retry() {
throw std::runtime_error("cta::ArchiveJob::retry(): not implemented");
}
......@@ -85,12 +85,6 @@ public:
*
*/
virtual void failed(const cta::exception::Exception &ex);
/**
* Indicates that the job should be tried again (typically reaching the end
* of the tape).
*/
virtual void retry();
private:
std::unique_ptr<cta::SchedulerDatabase::ArchiveJob> m_dbJob;
......
......@@ -50,14 +50,7 @@ void cta::RetrieveJob::complete() {
// failed
//------------------------------------------------------------------------------
void cta::RetrieveJob::failed() {
throw std::runtime_error("cta::RetrieveJob::failed(): not implemented");
}
//------------------------------------------------------------------------------
// retry
//------------------------------------------------------------------------------
void cta::RetrieveJob::retry() {
throw std::runtime_error("cta::RetrieveJob::retry(): not implemented");
m_dbJob->fail();
}
//------------------------------------------------------------------------------
......
......@@ -83,16 +83,11 @@ public:
/**
* Indicates that the job failed. Like for complete(), reason for failure
* should already be recorded in the object beforehand.
* should already be recorded in the object beforehand. Retry policy will
* be applied by the scheduler.
*/
virtual void failed();
/**
* Indicates that the job should be tried again (typically reaching the end
* of the tape).
*/
void retry();
/**
* Helper function returning a reference to the currently selected tape file.
*/
......
......@@ -184,7 +184,14 @@ namespace unitTests {
int tmpFileFd = mkstemp(path);
cta::exception::Errnum::throwOnMinusOne(tmpFileFd, "Error creating a temporary file");
m_path = path;
cta::exception::Errnum::throwOnMinusOne(write(tmpFileFd, content.c_str(), content.size()));
try {
cta::exception::Errnum::throwOnMinusOne(write(tmpFileFd, content.c_str(), content.size()));
} catch (...) {
close (tmpFileFd);
::unlink(m_path.c_str());
throw;
}
close (tmpFileFd);
}
~TempFileForXrootKey() {
::unlink(m_path.c_str());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment