Dir::hard_link: dont support symlink following
if we're asked to follow symlinks, give ERRNO_INVAL instead.
This commit is contained in:
@@ -200,7 +200,6 @@ impl WasiDir for Dir {
|
|||||||
fn hard_link(
|
fn hard_link(
|
||||||
&self,
|
&self,
|
||||||
src_path: &str,
|
src_path: &str,
|
||||||
symlink_follow: bool, // XXX not in cap-std yet
|
|
||||||
target_dir: &dyn WasiDir,
|
target_dir: &dyn WasiDir,
|
||||||
target_path: &str,
|
target_path: &str,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ pub trait WasiDir {
|
|||||||
fn hard_link(
|
fn hard_link(
|
||||||
&self,
|
&self,
|
||||||
path: &str,
|
path: &str,
|
||||||
symlink_follow: bool,
|
|
||||||
target_dir: &dyn WasiDir,
|
target_dir: &dyn WasiDir,
|
||||||
target_path: &str,
|
target_path: &str,
|
||||||
) -> Result<(), Error>;
|
) -> Result<(), Error>;
|
||||||
|
|||||||
@@ -749,10 +749,13 @@ impl<'a> wasi_snapshot_preview1::WasiSnapshotPreview1 for WasiCtx {
|
|||||||
.get_dir(u32::from(target_fd))?
|
.get_dir(u32::from(target_fd))?
|
||||||
.get_cap(DirCaps::LINK_TARGET)?;
|
.get_cap(DirCaps::LINK_TARGET)?;
|
||||||
let symlink_follow = src_flags.contains(types::Lookupflags::SYMLINK_FOLLOW);
|
let symlink_follow = src_flags.contains(types::Lookupflags::SYMLINK_FOLLOW);
|
||||||
|
if symlink_follow {
|
||||||
|
return Err(Error::invalid_argument()
|
||||||
|
.context("symlink following on path_link is not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
src_dir.hard_link(
|
src_dir.hard_link(
|
||||||
src_path.as_str()?.deref(),
|
src_path.as_str()?.deref(),
|
||||||
symlink_follow,
|
|
||||||
target_dir.deref(),
|
target_dir.deref(),
|
||||||
target_path.as_str()?.deref(),
|
target_path.as_str()?.deref(),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user