summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2019-07-01 17:53:13 -0700
committerWilliam A. Kennington III <wak@google.com>2019-07-08 16:25:30 -0700
commit64725031be90808f918423527cd2a32627bdf285 (patch)
treef24e99d9f065ad9b77f00627e7952b5661c57327 /src
parent7d75a48513560d8735bb3d795bb8872af276ee43 (diff)
downloadstdplus-64725031be90808f918423527cd2a32627bdf285.tar.gz
stdplus-64725031be90808f918423527cd2a32627bdf285.zip
signal: Use callCheckErrno
Change-Id: I75f010a17366550fd9cda550f973ae40951cbcb9 Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/stdplus/signal.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/stdplus/signal.cpp b/src/stdplus/signal.cpp
index 10f8e39..85b9f1e 100644
--- a/src/stdplus/signal.cpp
+++ b/src/stdplus/signal.cpp
@@ -1,5 +1,6 @@
#include <signal.h>
#include <stdplus/signal.hpp>
+#include <stdplus/util/cexec.hpp>
#include <system_error>
namespace stdplus
@@ -7,25 +8,14 @@ namespace stdplus
namespace signal
{
+using util::callCheckErrno;
+
void block(int signum)
{
sigset_t set;
- if (sigprocmask(SIG_BLOCK, nullptr, &set) < 0)
- {
- throw std::system_error(errno, std::generic_category(),
- "sigprocmask get");
- }
-
- if (sigaddset(&set, signum) < 0)
- {
- throw std::system_error(errno, std::generic_category(), "sigaddset");
- }
-
- if (sigprocmask(SIG_BLOCK, &set, nullptr) < 0)
- {
- throw std::system_error(errno, std::generic_category(),
- "sigprocmask set");
- }
+ callCheckErrno("sigprocmask get", sigprocmask, SIG_BLOCK, nullptr, &set);
+ callCheckErrno("sigaddset", sigaddset, &set, signum);
+ callCheckErrno("sigprocmask set", sigprocmask, SIG_BLOCK, &set, nullptr);
}
} // namespace signal
OpenPOWER on IntegriCloud