Skip to content

Commit

Permalink
Merge pull request #126 from anthonypapetti/issue-71222
Browse files Browse the repository at this point in the history
Handling unrecoverable ABRT signals in HDF5 Library
  • Loading branch information
selimnairb authored Nov 8, 2024
2 parents 032d4a8 + cad3943 commit 537fb5d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions api/bag_dataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <regex>
#include <string>
#include <memory>
#include <csignal>


namespace BAG {
Expand Down Expand Up @@ -1055,6 +1056,11 @@ std::tuple<double, double> Dataset::gridToGeo(
return {x, y};
}

void handleAbrt(int signum) {
std::cerr << "\nUnrecoverable HDF5 Error \n";
exit(signum);
}

//! Read an existing BAG.
/*!
\param fileName
Expand All @@ -1066,6 +1072,7 @@ void Dataset::readDataset(
const std::string& fileName,
OpenMode openMode)
{
signal(SIGABRT, handleAbrt);
m_pH5file = std::unique_ptr<::H5::H5File, DeleteH5File>(new ::H5::H5File{
fileName.c_str(),
(openMode == BAG_OPEN_READONLY) ? H5F_ACC_RDONLY : H5F_ACC_RDWR},
Expand Down

0 comments on commit 537fb5d

Please sign in to comment.