mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 12:05:30 +00:00
Fix log file writing
This commit is contained in:
parent
c2c3bf0ba4
commit
b325aa4555
@ -80,10 +80,6 @@ static void logfile_writer(int pipefd) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Read message
|
||||
if (xread(pipefd, buf + TIME_FMT_LEN + 1, meta.len) != meta.len)
|
||||
return;
|
||||
|
||||
timeval tv;
|
||||
tm tm;
|
||||
gettimeofday(&tv, nullptr);
|
||||
@ -107,10 +103,14 @@ static void logfile_writer(int pipefd) {
|
||||
}
|
||||
size_t off = strftime(buf, sizeof(buf), "%m-%d %T", &tm);
|
||||
int ms = tv.tv_usec / 1000;
|
||||
snprintf(buf + off, sizeof(buf) - off,
|
||||
off += snprintf(buf + off, sizeof(buf) - off,
|
||||
".%03d %5d %5d %c : ", ms, meta.pid, meta.tid, type);
|
||||
|
||||
strm->write(buf, TIME_FMT_LEN + meta.len);
|
||||
// Read message
|
||||
if (xread(pipefd, buf + off, meta.len) != meta.len)
|
||||
return;
|
||||
|
||||
strm->write(buf, off + meta.len);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user