From cbfebdbadb283ee13c555e7d79037fb5089caa4a Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Tue, 24 Apr 2018 14:13:30 -0700 Subject: [PATCH] logd: notify kernel log readers of new messages LogBuffer::log() returns either a negative number on error or a positive number indicating the length of the message written. Therefore, the check to notify kernel log readers of a new message should be that this function's return value is > 0. Bug: 78209416 Test: `adb logcat -b kernel` updates when new log messages are present Change-Id: Icc18c0c22e62340994e5c26aedb72282d61c1541 --- logd/LogKlog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index 7a7ac7da8..ab980ac5d 100755 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -825,7 +825,7 @@ int LogKlog::log(const char* buf, ssize_t len) { (unsigned short)n); // notify readers - if (!rc) { + if (rc > 0) { reader->notifyNewLog(static_cast(1 << LOG_ID_KERNEL)); }