aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-20 09:57:54 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-20 09:57:54 -0600
commit717805a593b58c69763dcabadff0b4aff182c80b (patch)
tree0e4d53235da8be43079e9902c7908d5df589a800
parent6ffd459479dde59f471eb42ef0515dd964b6a9d9 (diff)
parentacafcacfdcbd900674a68f455df25eda08f40688 (diff)
downloadservo-717805a593b58c69763dcabadff0b4aff182c80b.tar.gz
servo-717805a593b58c69763dcabadff0b4aff182c80b.zip
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.
-rw-r--r--components/servo/main.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/components/servo/main.rs b/components/servo/main.rs
index 4bef932e562..772a0eaa3fe 100644
--- a/components/servo/main.rs
+++ b/components/servo/main.rs
@@ -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')),
_ => {}
}
}