From daf7263c5a4e29d9549b3c0582e578a352532296 Mon Sep 17 00:00:00 2001 From: Jun Ouyang Date: Wed, 27 Mar 2024 10:10:13 +0800 Subject: [PATCH] feat(ofs): fix code --- bin/ofs/src/fuse.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ofs/src/fuse.rs b/bin/ofs/src/fuse.rs index dd2e21be5bee..51e19378247f 100644 --- a/bin/ofs/src/fuse.rs +++ b/bin/ofs/src/fuse.rs @@ -676,15 +676,15 @@ impl PathFilesystem for Fuse { whence ); + let whence = whence as i32; + let file = self.get_opened_file(FileKey::try_from(fh)?, path)?; if !file.is_read && !file.is_write { Err(Errno::from(libc::EACCES))?; } - let whence = whence as i32; - - let offset = if whence == libc::SEEK_CUR || whence == libc::SEEK_SET { + let offset = if whence == libc::SEEK_SET { offset } else if whence == libc::SEEK_END { let metadata = self @@ -700,7 +700,7 @@ impl PathFilesystem for Fuse { 0 } } else { - return Err(libc::EINVAL.into()); + return Err(libc::ENOSYS.into()); }; Ok(ReplyLSeek { offset })