Skip to content

Commit

Permalink
feat(ofs): fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Mar 27, 2024
1 parent e7c1574 commit daf7263
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bin/ofs/src/fuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -700,7 +700,7 @@ impl PathFilesystem for Fuse {
0
}
} else {
return Err(libc::EINVAL.into());
return Err(libc::ENOSYS.into());
};

Ok(ReplyLSeek { offset })
Expand Down

0 comments on commit daf7263

Please sign in to comment.