diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-11-05 16:23:46 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-11-05 16:23:46 +0000 |
commit | ec2d3ee159c4314a7282721692d1d49db282b925 (patch) | |
tree | de7c8f0a6d7fc5318b3bd2a842d69cf5a351c534 | |
parent | Fix narrowing warning (diff) | |
download | project2-1.2.8.1.tar.bz2 project2-1.2.8.1.tar.xz project2-1.2.8.1.zip |
Fix throw in destructorsproject2-1.2.8.1
-rw-r--r-- | project2/common/appInstance.cpp | 4 | ||||
-rw-r--r-- | project2/compression/gzip.cpp | 4 | ||||
-rw-r--r-- | project2/daemon/tempPrivs.cpp | 8 |
3 files changed, 4 insertions, 12 deletions
diff --git a/project2/common/appInstance.cpp b/project2/common/appInstance.cpp index 72d34a9..3f8ab58 100644 --- a/project2/common/appInstance.cpp +++ b/project2/common/appInstance.cpp @@ -13,9 +13,7 @@ AppInstance::AppInstance() AppInstance::~AppInstance() { - if (_current != this) { - throw std::runtime_error("All kinds of bad, destroying a non-current AppInstance"); - } + BOOST_ASSERT_MSG(_current == this, "All kinds of bad, destroying a non-current AppInstance"); _current = NULL; } diff --git a/project2/compression/gzip.cpp b/project2/compression/gzip.cpp index 653143f..cbccf40 100644 --- a/project2/compression/gzip.cpp +++ b/project2/compression/gzip.cpp @@ -19,9 +19,7 @@ class GZip : public Decompressor { ~GZip() { inflateEnd(&strm); - if (status != Z_STREAM_END) { - throw std::runtime_error("decompression of stream failed"); - } + BOOST_ASSERT_MSG(status == Z_STREAM_END, "decompression of stream failed"); } void decompress(const char * data, size_t len, const Stream::Sink & sink) { diff --git a/project2/daemon/tempPrivs.cpp b/project2/daemon/tempPrivs.cpp index 9c5edbd..45af498 100644 --- a/project2/daemon/tempPrivs.cpp +++ b/project2/daemon/tempPrivs.cpp @@ -20,14 +20,10 @@ TempPrivs::TempPrivs() : TempPrivs::~TempPrivs() { if (DaemonAppEngine::setUser) { - if (seteuid(originalUid)) { - throw std::runtime_error("Failed restore uid"); - } + BOOST_ASSERT_MSG(!seteuid(originalUid), "Failed restore uid"); } if (DaemonAppEngine::setGroup) { - if (setegid(originalGid)) { - throw std::runtime_error("Failed restore gid"); - } + BOOST_ASSERT_MSG(!setegid(originalGid), "Failed restore gid"); } } |