Make android logging thread only process buffer slice that contains real data.

This commit is contained in:
Josh Matthews 2018-10-15 10:46:24 -04:00
parent 4e61d97030
commit e75beaa8d6

View file

@ -491,6 +491,9 @@ fn redirect_stdout_to_logcat() {
result as usize + cursor
};
// Only modify the portion of the buffer that contains real data.
let buf = &mut buf[0..end];
if let Some(last_newline_pos) = buf.iter().rposition(|&c| c == b'\n' as c_char) {
buf[last_newline_pos] = b'\0' as c_char;
unsafe {