diff --git a/src/main.rs b/src/main.rs index b0b90a9..6fbeade 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,6 +36,9 @@ impl file_rpc::Server for Serv { fn read(&self, fd: u64, pos: u64, len: usize) -> Result, ()> { let (mount_id, file_offset, size) = self.files.read()[fd as usize]; let read_len = usize::min(len, size - (pos as usize)); + if read_len == 0 { + return Ok(Vec::new()); + }; let mounts = self.mounts.read(); let mount = &mounts[mount_id as usize]; (&mount.0).seek(std::io::SeekFrom::Start(file_offset + pos)).unwrap();