From 86353cdff5c2240f5f49c4b3396e8983740a3ba3 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 2 Jun 2017 19:00:54 -0700 Subject: [PATCH] Allow seek beyond end of file. This is enough to fix as. I don't know if it correctly fills the space with zeros when writing beyond the current EOF. --- mount/redox/resource.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mount/redox/resource.rs b/mount/redox/resource.rs index e406dd564b..e2477a3501 100644 --- a/mount/redox/resource.rs +++ b/mount/redox/resource.rs @@ -164,9 +164,9 @@ impl Resource for FileResource { let size = fs.node_len(self.block)?; self.seek = match whence { - SEEK_SET => max(0, min(size as i64, offset as i64)) as u64, - SEEK_CUR => max(0, min(size as i64, self.seek as i64 + offset as i64)) as u64, - SEEK_END => max(0, min(size as i64, size as i64 + offset as i64)) as u64, + SEEK_SET => max(0, offset as i64) as u64, + SEEK_CUR => max(0, self.seek as i64 + offset as i64) as u64, + SEEK_END => max(0, size as i64 + offset as i64) as u64, _ => return Err(Error::new(EINVAL)) };