1
0
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:
sudden6 2017-10-06 22:57:24 +02:00
commit e8a27441ff
No known key found for this signature in database
GPG Key ID: 279509B499E032B9

View File

@ -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);