Return error when dup buf is not empty

This commit is contained in:
Jeremy Soller
2017-07-22 13:16:41 -06:00
parent 133d38ba7e
commit 7f1eddc84d
2 changed files with 10 additions and 2 deletions
+5 -1
View File
@@ -85,7 +85,11 @@ impl SchemeMut for EthernetScheme {
}
}
fn dup(&mut self, id: usize, _buf: &[u8]) -> Result<usize> {
fn dup(&mut self, id: usize, buf: &[u8]) -> Result<usize> {
if ! buf.is_empty() {
return Err(Error::new(EINVAL));
}
let next_id = self.next_id;
self.next_id += 1;
+5 -1
View File
@@ -150,7 +150,11 @@ impl SchemeMut for Ipd {
}
}
fn dup(&mut self, file: usize, _buf: &[u8]) -> Result<usize> {
fn dup(&mut self, file: usize, buf: &[u8]) -> Result<usize> {
if ! buf.is_empty() {
return Err(Error::new(EINVAL));
}
let handle = {
let handle = self.handles.get(&file).ok_or(Error::new(EBADF))?;
Handle {