mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #5289 : Ms2ger/servo/android-redirect, r=metajack
It will panic if there are any null bytes in read_buffer, but fgets guarantees that there is a null-terminator.
This commit is contained in:
commit
717805a593
1 changed files with 2 additions and 3 deletions
|
@ -88,9 +88,8 @@ fn redirect_output(file_no: c_int) {
|
|||
let mut read_buffer: [u8; 1024] = mem::zeroed();
|
||||
let FilePtr(input_file) = input_file;
|
||||
fgets(read_buffer.as_mut_ptr() as *mut i8, read_buffer.len() as i32, input_file);
|
||||
let cs = CString::from_slice(&read_buffer);
|
||||
match from_utf8(cs.as_bytes()) {
|
||||
Ok(s) => android_glue::write_log(s),
|
||||
match from_utf8(&read_buffer) {
|
||||
Ok(s) => android_glue::write_log(s.trim_right_matches('\0')),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue