summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'logd/LogListener.cpp')
-rw-r--r--logd/LogListener.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/logd/LogListener.cpp b/logd/LogListener.cpp
index dadc75f4c..709646e37 100644
--- a/logd/LogListener.cpp
+++ b/logd/LogListener.cpp
@@ -30,7 +30,7 @@
30#include "LogListener.h" 30#include "LogListener.h"
31#include "LogUtils.h" 31#include "LogUtils.h"
32 32
33LogListener::LogListener(LogBuffer* buf, LogReader* reader) 33LogListener::LogListener(LogBufferInterface* buf, LogReader* reader)
34 : SocketListener(getLogSocket(), false), logbuf(buf), reader(reader) { 34 : SocketListener(getLogSocket(), false), logbuf(buf), reader(reader) {
35} 35}
36 36
@@ -102,11 +102,14 @@ bool LogListener::onDataAvailable(SocketClient* cli) {
102 // NB: hdr.msg_flags & MSG_TRUNC is not tested, silently passing a 102 // NB: hdr.msg_flags & MSG_TRUNC is not tested, silently passing a
103 // truncated message to the logs. 103 // truncated message to the logs.
104 104
105 if (logbuf->log((log_id_t)header->id, header->realtime, cred->uid, 105 if (logbuf != nullptr) {
106 cred->pid, header->tid, msg, 106 int res = logbuf->log(
107 ((size_t)n <= USHRT_MAX) ? (unsigned short)n : USHRT_MAX) >= 107 (log_id_t)header->id, header->realtime, cred->uid, cred->pid,
108 0) { 108 header->tid, msg,
109 reader->notifyNewLog(); 109 ((size_t)n <= USHRT_MAX) ? (unsigned short)n : USHRT_MAX);
110 if (res > 0 && reader != nullptr) {
111 reader->notifyNewLog();
112 }
110 } 113 }
111 114
112 return true; 115 return true;