mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #4711
Vincas Dargis (1): fix(platform): use result to remove -Wunused-result warning
This commit is contained in:
commit
e8a27441ff
|
@ -53,7 +53,12 @@ static void signalHandler(int signum)
|
|||
if (g_signalSocketUsageFlag.test_and_set())
|
||||
return;
|
||||
|
||||
::write(g_signalSocketPair[0], &signum, sizeof(signum));
|
||||
if(::write(g_signalSocketPair[0], &signum, sizeof(signum)) == -1) {
|
||||
// We hardly can do anything more usefull in signal handler, and
|
||||
// any ways it's probably very unexpected error (out of memory?),
|
||||
// since we check socket existance with a flag beforehand.
|
||||
abort();
|
||||
}
|
||||
|
||||
g_signalSocketUsageFlag.clear();
|
||||
}
|
||||
|
@ -109,7 +114,9 @@ PosixSignalNotifier& PosixSignalNotifier::globalInstance()
|
|||
void PosixSignalNotifier::onSignalReceived()
|
||||
{
|
||||
int signum{0};
|
||||
::read(detail::g_signalSocketPair[1], &signum, sizeof(signum));
|
||||
if (::read(detail::g_signalSocketPair[1], &signum, sizeof(signum)) == -1) {
|
||||
qFatal("Failed to read from signal socket, error = %d", errno);
|
||||
}
|
||||
|
||||
qDebug() << "Signal" << signum << "received";
|
||||
emit activated(signum);
|
||||
|
|
Loading…
Reference in New Issue
Block a user