mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Check pthread_sigmask by its return value
`pthread_sigmask` returns the error number and does not set `errno`.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user