Test for BadFile

This commit is contained in:
Jeremy Soller 2016-08-14 19:17:55 -06:00
parent d97e2e4b4a
commit 8a6d9b8c9d
2 changed files with 19 additions and 5 deletions

View file

@ -5,7 +5,12 @@ use super::{Error, Result};
/// Read syscall
pub fn read(fd: usize, buf: &mut [u8]) -> Result<usize> {
println!("Read {}: {}", fd, buf.len());
Ok(0)
if let Some(file) = unsafe { &mut ::context::CONTEXT }.files.get(fd) {
println!("{:?}", file);
Ok(0)
} else {
Err(Error::BadFile)
}
}
/// Write syscall