diff options
author | Mark Salyzyn | 2017-03-22 16:58:53 -0500 |
---|---|---|
committer | Mark Salyzyn | 2017-03-27 17:49:24 -0500 |
commit | 479c8c2e4261f7a8f3ef2ac58395f7008b5b0aa8 (patch) | |
tree | 09e1454a7f653dcff998e2d9472015ae9261ed73 /logd/LogBufferElement.cpp | |
parent | b15429c0eade8a5f9b456c5f0aa57eec697e9ff2 (diff) | |
download | platform-system-core-479c8c2e4261f7a8f3ef2ac58395f7008b5b0aa8.tar.gz platform-system-core-479c8c2e4261f7a8f3ef2ac58395f7008b5b0aa8.tar.xz platform-system-core-479c8c2e4261f7a8f3ef2ac58395f7008b5b0aa8.zip |
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
Diffstat (limited to 'logd/LogBufferElement.cpp')
-rw-r--r-- | logd/LogBufferElement.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/logd/LogBufferElement.cpp b/logd/LogBufferElement.cpp index 81356fea5..04a620c5c 100644 --- a/logd/LogBufferElement.cpp +++ b/logd/LogBufferElement.cpp | |||
@@ -235,7 +235,9 @@ log_time LogBufferElement::flushTo(SocketClient* reader, LogBuffer* parent, | |||
235 | } | 235 | } |
236 | iovec[1].iov_len = entry.len; | 236 | iovec[1].iov_len = entry.len; |
237 | 237 | ||
238 | log_time retval = reader->sendDatav(iovec, 2) ? FLUSH_ERROR : mRealTime; | 238 | log_time retval = reader->sendDatav(iovec, 1 + (entry.len != 0)) |
239 | ? FLUSH_ERROR | ||
240 | : mRealTime; | ||
239 | 241 | ||
240 | if (buffer) free(buffer); | 242 | if (buffer) free(buffer); |
241 | 243 | ||