From 16ab7064ce31176170ec3f99406023750d3cb26f Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 23 Dec 2023 17:58:51 +0100 Subject: [PATCH] Return correct error for fd_seek on a directory --- src/fs_core.ts | 4 ++++ test/skip.json | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fs_core.ts b/src/fs_core.ts index 528fb68..32f57c4 100644 --- a/src/fs_core.ts +++ b/src/fs_core.ts @@ -242,6 +242,10 @@ export class OpenDirectory extends Fd { this.dir = dir; } + fd_seek(offset: bigint, whence: number): { ret: number; offset: bigint } { + return { ret: wasi.ERRNO_ISDIR, offset: 0n }; + } + fd_fdstat_get(): { ret: number; fdstat: wasi.Fdstat | null } { return { ret: 0, fdstat: new wasi.Fdstat(wasi.FILETYPE_DIRECTORY, 0) }; } diff --git a/test/skip.json b/test/skip.json index 3264d07..e8af7c3 100644 --- a/test/skip.json +++ b/test/skip.json @@ -32,7 +32,6 @@ "nofollow_errors": "fail", "path_open_preopen": "fail", "fd_readdir": "fail", - "directory_seek": "fail", "symlink_filestat": "fail", "symlink_loop": "fail", "interesting_paths": "fail"