From 57c8eacee450c2916e54e6ac37f2db2c4f9b3984 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 9 Apr 2020 14:53:55 -0700 Subject: liblog: support extended logger_entry headers logger_entry has a hdr_size field meant for backwards compatibility, however there are a few checks that expect it to be a specific size. More problematically, it has a variable length array element, msg[0] at the end, that would be incorrect if the header size was not kept static. This change fixes up those issues to facilitate future additions. Bug: 119867234 Test: logging works with extended size headers, logging unit tests Test: newly added unit tests with extended size header Merged-In: I14b2b0855d219d11f374b53a5aa8e05cd6a65eef Change-Id: I14b2b0855d219d11f374b53a5aa8e05cd6a65eef (cherry picked from commit d3ecc66b9cb38974ef0d19ed9e25074bbe70f1fa) --- logd/tests/logd_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'logd/tests/logd_test.cpp') diff --git a/logd/tests/logd_test.cpp b/logd/tests/logd_test.cpp index f47bee1c06..d0945f31f4 100644 --- a/logd/tests/logd_test.cpp +++ b/logd/tests/logd_test.cpp @@ -246,7 +246,7 @@ static void dump_log_msg(const char* prefix, log_msg* msg, int lid) { std::cerr << std::flush; fflush(stdout); fflush(stderr); - EXPECT_EQ(sizeof(logger_entry), msg->entry.hdr_size); + EXPECT_GE(msg->entry.hdr_size, sizeof(logger_entry)); fprintf(stderr, "%s: [%u] ", prefix, msg->len()); fprintf(stderr, "hdr_size=%u ", msg->entry.hdr_size); -- cgit v1.2.3