Force set timezone to UTC in logd.
(cherry picked from commit c27f12a3d396f113c5ae09d2f2c8ff7de3f8b551) logd assumes that it is running in UTC time zone. However, if persist.sys.timezone is set at some point later, that affects and confuses logd behavior. To avoid such a case, this CL sets TZ to UTC, which overrides the property's behavior. Test: Ran CtsOsTestCases. Test: gTest liblog-unit-tests, logd-unit-tests and logcat-unit-tests Bug: 33566779 Change-Id: Ib9edd4cb06f019a33aaf8d77d33bd82fdbbda480
This commit is contained in:
parent
e4e4777fc7
commit
352476e118
|
@ -407,6 +407,11 @@ static int issueReinit() {
|
|||
// logging plugins like auditd and restart control. Additional
|
||||
// transitory per-client threads are created for each reader.
|
||||
int main(int argc, char* argv[]) {
|
||||
// logd is written under the assumption that the timezone is UTC.
|
||||
// If TZ is not set, persist.sys.timezone is looked up in some time utility
|
||||
// libc functions, including mktime. It confuses the logd time handling,
|
||||
// so here explicitly set TZ to UTC, which overrides the property.
|
||||
setenv("TZ", "UTC", 1);
|
||||
// issue reinit command. KISS argument parsing.
|
||||
if ((argc > 1) && argv[1] && !strcmp(argv[1], "--reinit")) {
|
||||
return issueReinit();
|
||||
|
|
Loading…
Reference in New Issue