diff options
| author | Mark Salyzyn <salyzyn@google.com> | 2017-03-27 22:42:44 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-03-27 22:42:44 +0000 |
| commit | 02ce4262dc2dc14c16a49cc62dfae65e15043d03 (patch) | |
| tree | 739a7a7bc9d0e355ba6aa7bba7068504f7d1bafc /logd/LogBuffer.cpp | |
| parent | abca5ef0272a0066150efcc5030886e74538d8ff (diff) | |
| parent | 77a1fa9070867505a0a70cfa484c268310819cab (diff) | |
| download | system_core-02ce4262dc2dc14c16a49cc62dfae65e15043d03.tar.gz system_core-02ce4262dc2dc14c16a49cc62dfae65e15043d03.tar.bz2 system_core-02ce4262dc2dc14c16a49cc62dfae65e15043d03.zip | |
Merge changes I96998c4b,I161bf03b am: dd0cd8d88f am: f17500474a
am: 77a1fa9070
Change-Id: I5b296f6c1b01a8b2dc51c7ebbd44d599a3aa49c1
Diffstat (limited to 'logd/LogBuffer.cpp')
| -rw-r--r-- | logd/LogBuffer.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index dd78275f5..1f52d047c 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -132,11 +132,11 @@ static enum match_type identical(LogBufferElement* elem, LogBufferElement* last) { // is it mostly identical? // if (!elem) return DIFFERENT; - unsigned short lenl = elem->getMsgLen(); - if (!lenl) return DIFFERENT; + ssize_t lenl = elem->getMsgLen(); + if (lenl <= 0) return DIFFERENT; // value if this represents a chatty elem // if (!last) return DIFFERENT; - unsigned short lenr = last->getMsgLen(); - if (!lenr) return DIFFERENT; + ssize_t lenr = last->getMsgLen(); + if (lenr <= 0) return DIFFERENT; // value if this represents a chatty elem // if (elem->getLogId() != last->getLogId()) return DIFFERENT; if (elem->getUid() != last->getUid()) return DIFFERENT; if (elem->getPid() != last->getPid()) return DIFFERENT; @@ -163,8 +163,6 @@ static enum match_type identical(LogBufferElement* elem, } // audit message (except sequence number) identical? - static const char avc[] = "): avc: "; - if (last->isBinary()) { if (fastcmp<memcmp>(msgl, msgr, sizeof(android_log_event_string_t) - sizeof(int32_t))) { @@ -175,6 +173,7 @@ static enum match_type identical(LogBufferElement* elem, msgr += sizeof(android_log_event_string_t); lenr -= sizeof(android_log_event_string_t); } + static const char avc[] = "): avc: "; const char* avcl = android::strnstr(msgl, lenl, avc); if (!avcl) return DIFFERENT; lenl -= avcl - msgl; @@ -182,10 +181,7 @@ static enum match_type identical(LogBufferElement* elem, if (!avcr) return DIFFERENT; lenr -= avcr - msgr; if (lenl != lenr) return DIFFERENT; - // TODO: After b/35468874 is addressed, revisit "lenl > strlen(avc)" - // condition, it might become superfluous. - if (lenl > strlen(avc) && - fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc), + if (fastcmp<memcmp>(avcl + strlen(avc), avcr + strlen(avc), lenl - strlen(avc))) { return DIFFERENT; } @@ -1094,12 +1090,12 @@ log_time LogBuffer::flushTo( // client wants to start from the beginning it = mLogElements.begin(); } else { - LogBufferElementCollection::iterator last = mLogElements.begin(); + LogBufferElementCollection::iterator last; // 30 second limit to continue search for out-of-order entries. log_time min = start - log_time(30, 0); // Client wants to start from some specified time. Chances are // we are better off starting from the end of the time sorted list. - for (it = mLogElements.end(); it != mLogElements.begin(); + for (last = it = mLogElements.end(); it != mLogElements.begin(); /* do nothing */) { --it; LogBufferElement* element = *it; |
