Return error if dup buf is not empty

This commit is contained in:
Jeremy Soller
2017-07-22 13:08:08 -06:00
parent 3342778968
commit f40f6921e8
+5 -1
View File
@@ -398,9 +398,13 @@ impl Scheme for FileScheme {
/* Resource operations */
#[allow(unused_variables)]
fn dup(&self, old_id: usize, _buf: &[u8]) -> Result<usize> {
fn dup(&self, old_id: usize, buf: &[u8]) -> Result<usize> {
// println!("Dup {}", old_id);
if ! buf.is_empty() {
return Err(Error::new(ENOENT));
}
let mut files = self.files.lock();
let resource = if let Some(old_resource) = files.get(&old_id) {
old_resource.dup()?