Skip to content

Commit f0cf18d

Browse files
committed
fix: handle partial writes from libc::write
1 parent 9da87b9 commit f0cf18d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,8 @@ fn print_system_info(
107107
if written < 0 {
108108
return Err(io::Error::last_os_error().into());
109109
}
110+
if written as usize != len {
111+
return Err(io::Error::new(io::ErrorKind::WriteZero, "partial write to stdout").into());
112+
}
110113
Ok(())
111114
}

0 commit comments

Comments
 (0)