Fixes path_symlink_trailing_slashes on Windows

This commit:
* adds missing `ERROR_ALREADY_EXISTS => __WASI_EEXIST` mapping
* re-routes Win errors into correct WASI values in `symlink_*`
  fns when target exists and/or contains a trailing slash
* remaps `ERROR_INVALID_NAME => __WASI_ENOENT`
This commit is contained in:
Jakub Konka
2019-10-28 22:49:50 +01:00
parent 59bbfbc0d7
commit bb5c879718
4 changed files with 22 additions and 2 deletions

View File

@@ -22,7 +22,7 @@ pub(crate) fn errno_from_win(error: winx::winerror::WinError) -> host::__wasi_er
ERROR_SHARING_VIOLATION => host::__WASI_EACCES,
ERROR_PRIVILEGE_NOT_HELD => host::__WASI_ENOTCAPABLE, // TODO is this the correct mapping?
ERROR_INVALID_HANDLE => host::__WASI_EBADF,
ERROR_INVALID_NAME => host::__WASI_EINVAL,
ERROR_INVALID_NAME => host::__WASI_ENOENT,
ERROR_NOT_ENOUGH_MEMORY => host::__WASI_ENOMEM,
ERROR_OUTOFMEMORY => host::__WASI_ENOMEM,
ERROR_DIR_NOT_EMPTY => host::__WASI_ENOTEMPTY,
@@ -35,6 +35,7 @@ pub(crate) fn errno_from_win(error: winx::winerror::WinError) -> host::__wasi_er
ERROR_NOT_A_REPARSE_POINT => host::__WASI_EINVAL,
ERROR_NEGATIVE_SEEK => host::__WASI_EINVAL,
ERROR_DIRECTORY => host::__WASI_ENOTDIR,
ERROR_ALREADY_EXISTS => host::__WASI_EEXIST,
_ => host::__WASI_ENOTSUP,
}
}