Skip to content

Commit

Permalink
Merge pull request #48 from HarikrishnanBalagopal/fix/errorcode
Browse files Browse the repository at this point in the history
fix: error code from path_open is not correct when trying to open a non-directory as a directory
  • Loading branch information
bjorn3 authored Nov 14, 2023
2 parents 51f5c29 + c381a59 commit 3fa27ab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/fs_fd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ export class OpenDirectory extends Fd {
}
if (
(oflags & wasi.OFLAGS_DIRECTORY) == wasi.OFLAGS_DIRECTORY &&
entry.stat().filetype != wasi.FILETYPE_DIRECTORY
entry.stat().filetype !== wasi.FILETYPE_DIRECTORY
) {
// file is actually a directory
return { ret: wasi.ERRNO_ISDIR, fd_obj: null };
// expected a directory but the file is not a directory
return { ret: wasi.ERRNO_NOTDIR, fd_obj: null };
}
if (
entry.readonly &&
Expand Down

0 comments on commit 3fa27ab

Please sign in to comment.