mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-22 16:35:33 +00:00
This commit changes `path_open` to return errno `noent` when the input path is empty. This is consistent with other runtimes as well as Linux host. POSIX also specifies this behavior. fixes #4755
27 lines
564 B
Rust
27 lines
564 B
Rust
#[link(wasm_import_module = "wasi_snapshot_preview1")]
|
|
extern "C" {
|
|
pub fn path_open(
|
|
fd: i32,
|
|
dirflags: i32,
|
|
path: i32,
|
|
path_len: i32,
|
|
oflags: i32,
|
|
fs_rights_base: i64,
|
|
fs_rights_inheriting: i64,
|
|
fdflags: i32,
|
|
result_fd: i32,
|
|
) -> i32;
|
|
}
|
|
|
|
const ERRNO_NOENT: i32 = 44;
|
|
|
|
fn main() {
|
|
unsafe {
|
|
let errno = path_open(5, 0, 0, 0, 0, 0, 0, 0, 1024);
|
|
assert_eq!(
|
|
errno, ERRNO_NOENT,
|
|
"empty path should not resolve successfully"
|
|
);
|
|
}
|
|
}
|