failure to create trailing slash symlink to file can be EEXIST or ENOTDIR

This commit is contained in:
Pat Hickey
2021-01-11 15:56:13 -08:00
parent 932ba6b4f3
commit f084cf1fd0

View File

@@ -40,12 +40,12 @@ unsafe fn test_path_symlink_trailing_slashes(dir_fd: wasi::Fd) {
// Link destination already exists, target has trailing slash.
create_file(dir_fd, "target");
assert_eq!(
wasi::path_symlink("source", dir_fd, "target/")
let dir_symlink_errno = wasi::path_symlink("source", dir_fd, "target/")
.expect_err("link destination already exists")
.raw_error(),
wasi::ERRNO_EXIST,
"errno should be ERRNO_EXIST"
.raw_error();
assert!(
dir_symlink_errno == wasi::ERRNO_EXIST || dir_symlink_errno == wasi::ERRNO_NOTDIR,
"errno should be ERRNO_EXIST or ERRNO_NOTDIR"
);
wasi::path_unlink_file(dir_fd, "target").expect("removing a file");