Skip to content

Commit

Permalink
path: import types from handle rather than wasi
Browse files Browse the repository at this point in the history
  • Loading branch information
pchickey committed Sep 14, 2020
1 parent e47927f commit e5129b3
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions crates/wasi-common/src/path.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::entry::Entry;
use crate::handle::{Handle, HandleRights};
use crate::wasi::types;
use crate::handle::{Fdflags, Filetype, Handle, HandleRights, Lookupflags, Oflags};
use crate::{Error, Result};
use std::path::{Component, Path};
use std::str;
Expand All @@ -13,7 +12,7 @@ pub(crate) use crate::sys::path::{from_host, open_rights};
pub(crate) fn get(
entry: &Entry,
required_rights: &HandleRights,
dirflags: types::Lookupflags,
dirflags: Lookupflags,
path: &str,
needs_final_component: bool,
) -> Result<(Box<dyn Handle>, String)> {
Expand All @@ -26,7 +25,7 @@ pub(crate) fn get(
return Err(Error::Ilseq);
}

if entry.get_file_type() != types::Filetype::Directory {
if entry.get_file_type() != Filetype::Directory {
// if `dirfd` doesn't refer to a directory, return `Notdir`.
return Err(Error::Notdir);
}
Expand Down Expand Up @@ -102,8 +101,8 @@ pub(crate) fn get(
&head,
false,
false,
types::Oflags::DIRECTORY,
types::Fdflags::empty(),
Oflags::DIRECTORY,
Fdflags::empty(),
) {
Ok(new_dir) => {
dir_stack.push(new_dir);
Expand Down Expand Up @@ -141,8 +140,7 @@ pub(crate) fn get(
}

continue;
} else if ends_with_slash
|| dirflags.contains(&types::Lookupflags::SYMLINK_FOLLOW)
} else if ends_with_slash || dirflags.contains(&Lookupflags::SYMLINK_FOLLOW)
{
// if there's a trailing slash, or if `LOOKUP_SYMLINK_FOLLOW` is set, attempt
// symlink expansion
Expand Down

0 comments on commit e5129b3

Please sign in to comment.