Fix path_remove_directory on *nixes

This commit is contained in:
Jakub Konka
2019-09-17 22:34:32 +02:00
parent 30a4f73cce
commit 90f1cd5c96
3 changed files with 4 additions and 2 deletions

View File

@@ -165,7 +165,6 @@ cfg_if::cfg_if! {
match name { match name {
"path_rename_trailing_slashes" => true, "path_rename_trailing_slashes" => true,
"path_symlink_trailing_slashes" => true, "path_symlink_trailing_slashes" => true,
"remove_directory_trailing_slashes" => true,
_ => false, _ => false,
} }
} else { } else {

View File

@@ -978,7 +978,9 @@ pub(crate) unsafe fn path_remove_directory(
let dirfd = wasi_ctx let dirfd = wasi_ctx
.get_fd_entry(dirfd, host::__WASI_RIGHT_PATH_REMOVE_DIRECTORY, 0) .get_fd_entry(dirfd, host::__WASI_RIGHT_PATH_REMOVE_DIRECTORY, 0)
.and_then(|fe| fe.fd_object.descriptor.as_file())?; .and_then(|fe| fe.fd_object.descriptor.as_file())?;
let resolved = path_get(dirfd, 0, path, false)?; let resolved = path_get(dirfd, 0, path, true)?;
log::debug!("path_remove_directory resolved={:?}", resolved);
hostcalls_impl::path_remove_directory(resolved) hostcalls_impl::path_remove_directory(resolved)
} }

View File

@@ -5,6 +5,7 @@ use crate::{host, Error, Result};
use std::fs::File; use std::fs::File;
use std::path::{Component, Path}; use std::path::{Component, Path};
#[derive(Debug)]
pub(crate) struct PathGet { pub(crate) struct PathGet {
dirfd: File, dirfd: File,
path: String, path: String,