-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Portably handle fd_advise
on directory fd
#2875
Conversation
This commit adds a check to `fd_advise`. If the fd is a directory, return `ebadf`. This brings iwasm in line with Wasmtime's behavior. WASI folks have stated that fd_advise should not work on directories as this is a Linux-specific behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@yagehu thanks for the fixing! Let's merge the PR. |
where in WASI or POSIX is it stated? |
The dirfd behavior is not specified by POSIX. I submitted this PR observing that using directory fds with |
my impression is that it should be fixed in wasmtime instead. |
This commit adds a check to `fd_advise`. If the fd is a directory, return `ebadf`. This brings iwasm in line with Wasmtime's behavior. WASI folks have stated that fd_advise should not work on directories as this is a Linux-specific behavior: bytecodealliance/wasmtime#6505 (comment)
This commit adds a check to
fd_advise
. If the fd is a directory, returnebadf
. This brings iwasm in line with Wasmtime's behavior. WASI folks have stated thatfd_advise
should not work on directories as this is a Linux-specific behavior.