From 81107f8cd1bb69bbd7934583e5e8f19d46c53091 Mon Sep 17 00:00:00 2001 From: Tom Almeida <tommoa256@gmail.com> Date: Tue, 3 Jul 2018 10:01:48 +0800 Subject: [PATCH] Don't reset read/write every time we check if we can read or write --- src/stdio/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs index b0af3f62..cb535608 100644 --- a/src/stdio/src/lib.rs +++ b/src/stdio/src/lib.rs @@ -64,6 +64,9 @@ impl FILE { } */ + if let Some(_) = self.read { + return true; + } if let Some(_) = self.write { self.write(&[]); } @@ -93,6 +96,9 @@ impl FILE { return false; } // Buffer repositioning + if let Some(_) = self.write { + return true; + } self.read = None; self.write = Some((self.unget, self.unget, self.buf.len() - 1)); return true; -- GitLab