From 29c45c725b770a9045e5489ab4e712b3c2191f5d Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sat, 22 Jul 2017 13:16:05 -0600 Subject: [PATCH] Return error when dup buf is not empty --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 6383797016..449e64a606 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,7 +52,11 @@ impl SchemeMut for PtyScheme { } } - fn dup(&mut self, id: usize, _buf: &[u8]) -> Result { + fn dup(&mut self, id: usize, buf: &[u8]) -> Result { + if ! buf.is_empty() { + return Err(Error::new(EINVAL)); + } + /* TODO CLOEXEC - Master cannot be cloned let master_opt = self.ptys.0.get(&id).map(|pipe| pipe.clone()); if let Some(pipe) = master_opt {