Journald: Do not emit signals for kernel messages

Those have no _PID set, which we treated as 0. This is also
the PID we set when an application is finished. This leads to
journald messages showing up in the application output *after*
the application was finished.

Change-Id: I980199740a85c4e68221399eceb543affa12387f
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Alexander Görtz <alexander.goertz@tu-dortmund.de>
This commit is contained in:
Tobias Hunger
2015-09-22 11:56:30 +02:00
committed by Alexander Görtz
parent 335f6e4363
commit ee42dcb66c

View File

@@ -227,7 +227,10 @@ void JournaldWatcher::handleEntry()
continue; continue;
const QByteArray pid = logEntry.value(QByteArrayLiteral("_PID")); const QByteArray pid = logEntry.value(QByteArrayLiteral("_PID"));
quint64 pidNum = pid.isEmpty() ? 0 : QString::fromLatin1(pid).toInt(); if (pid.isEmpty())
continue;
quint64 pidNum = QString::fromLatin1(pid).toInt();
QString message = QString::fromUtf8(logEntry.value(QByteArrayLiteral("MESSAGE"))); QString message = QString::fromUtf8(logEntry.value(QByteArrayLiteral("MESSAGE")));
message.append(QLatin1Char('\n')); // Add newline. message.append(QLatin1Char('\n')); // Add newline.