diff --git a/src/host.rs b/src/host.rs index 37594be301..d43a127633 100644 --- a/src/host.rs +++ b/src/host.rs @@ -508,14 +508,6 @@ pub(crate) fn path_from_slice<'a>(s: &'a [u8]) -> Result<&'a str> { str::from_utf8(s).map_err(|_| Error::EILSEQ) } -/// Creates owned WASI path from byte vector. -/// -/// NB WASI spec requires bytes to be valid UTF-8. Otherwise, -/// `__WASI_EILSEQ` error is returned. -pub(crate) fn path_from_vec>>(s: S) -> Result { - String::from_utf8(s.into()).map_err(|_| Error::EILSEQ) -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/hostcalls_impl/fs.rs b/src/hostcalls_impl/fs.rs index 58033283cc..a31a31c9e4 100644 --- a/src/hostcalls_impl/fs.rs +++ b/src/hostcalls_impl/fs.rs @@ -652,7 +652,7 @@ pub(crate) unsafe fn path_readlink( enc_usize_byref(memory, buf_used, 0)?; let dirfd = dec_fd(dirfd); - let path = dec_slice_of::(memory, path_ptr, path_len).and_then(host::path_from_vec)?; + let path = dec_slice_of::(memory, path_ptr, path_len).and_then(host::path_from_slice)?; trace!(" | (path_ptr,path_len)='{}'", &path);