diff --git a/src/pam/rpassword.rs b/src/pam/rpassword.rs index 3b97006c..85239528 100644 --- a/src/pam/rpassword.rs +++ b/src/pam/rpassword.rs @@ -105,7 +105,9 @@ fn read_unbuffered(source: &mut dyn io::Read) -> io::Result { fn erase_feedback(sink: &mut dyn io::Write, i: usize) { const BACKSPACE: u8 = 0x08; for _ in 0..i { - let _ = sink.write(&[BACKSPACE, b' ', BACKSPACE]); + if sink.write(&[BACKSPACE, b' ', BACKSPACE]).is_err() { + return; + } } }