Check pthread_sigmask by its return value

`pthread_sigmask` returns the error number and does not set `errno`.
This commit is contained in:
noctuum
2026-09-28 00:50:54 +05:00
committed by Jari Sundell
parent 8e23ba8b17
commit fc6e57c3fa
+8 -4
View File
@@ -63,8 +63,10 @@ SignalHandler::set_block(unsigned int signum) {
sigemptyset(&mask);
sigaddset(&mask, signum);
if (pthread_sigmask(SIG_BLOCK, &mask, NULL) == -1)
throw std::logic_error("Could not block signal: " + std::string(std::strerror(errno)));
int result = pthread_sigmask(SIG_BLOCK, &mask, NULL);
if (result != 0)
throw std::logic_error("Could not block signal: " + std::string(std::strerror(result)));
}
void
@@ -77,8 +79,10 @@ SignalHandler::set_unblock(unsigned int signum) {
sigemptyset(&mask);
sigaddset(&mask, signum);
if (pthread_sigmask(SIG_UNBLOCK, &mask, NULL) == -1)
throw std::logic_error("Could not unblock signal: " + std::string(std::strerror(errno)));
int result = pthread_sigmask(SIG_UNBLOCK, &mask, NULL);
if (result != 0)
throw std::logic_error("Could not unblock signal: " + std::string(std::strerror(result)));
}
void