Skip to content

Commit

Permalink
nblog: fix loop condition on getSnapshot
Browse files Browse the repository at this point in the history
Prevents unbounded looping

Test: treehugger
Bug: 340387001
Change-Id: Ie6e42342862285365691aa4225c1b07802a71b93
  • Loading branch information
xt0032rus committed May 14, 2024
1 parent fce7859 commit db09e4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion media/libnblog/Reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ std::unique_ptr<Snapshot> Reader::getSnapshot(bool flush)
do {
availToRead = mFifoReader->obtain(iovec, capacity, NULL /*timeout*/, &lostTemp);
lost += lostTemp;
} while (availToRead < 0 || ++tries <= kMaxObtainTries);
} while (availToRead < 0 && ++tries <= kMaxObtainTries);

if (availToRead <= 0) {
ALOGW_IF(availToRead < 0, "NBLog Reader %s failed to catch up with Writer", mName.c_str());
Expand Down

0 comments on commit db09e4b

Please sign in to comment.