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

Commit 479c8c2e authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

logd: strip out empty trailing iovec

If the last buffer has zero length, strip it out of the iovec
issued to SocketClient::sendDatav().

Test: gTest liblog-unit-tests, logd-unit-tests, logcat-unit-tests
Bug: 36497967
Change-Id: I8fc585bbec63402d0e818ff4c620fdd7edcc38dc
parent b15429c0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -235,7 +235,9 @@ log_time LogBufferElement::flushTo(SocketClient* reader, LogBuffer* parent,
    }
    iovec[1].iov_len = entry.len;

    log_time retval = reader->sendDatav(iovec, 2) ? FLUSH_ERROR : mRealTime;
    log_time retval = reader->sendDatav(iovec, 1 + (entry.len != 0))
                          ? FLUSH_ERROR
                          : mRealTime;

    if (buffer) free(buffer);