Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f46716f authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

logd: last iterator initialized incorrectly

last should start with mLogElements.end() and be updated as
we iterate to find a matching time entry in the list. Since
it is impossible(sic) for a newer start time to be supplied
than the list, the incorrect iterator initialization should
be inconsequential, but if it ever happens this change will
behave correctly and dump nothing.

Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests
Bug: 36536248
Bug: 36608728
Change-Id: I96998c4b713258f29d5db2e24a83ae562ddf3420
parent 0484b3b5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1088,12 +1088,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;