Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Surfaced when running sunfishcode/misc-tests. When trying to truncate the file without the
__WASI_RIGHT_PATH_FILESTAT_SET_SIZE
right, error__WASI_ENOTCAPABLE
was correctly returned, however, the guestfd
pointer was not encoded to -1 in that case. This commit fixes it by taking out the guestfd
encoding out of the conditional branch which turns out obsolete.To elaborate, before this fix, if everything was successful,
host_fd
with the resultant file descriptor value would be correctly encoded inside thefd
pointer. However, if there was an error inhost::wasmtime_ssp_path_open
call, thehost_fd
would correctly storewasm32::__wasi_fd_t::max_value()
(equivalent to -1) butfd
pointer would be untouched due to the encoding operation being behind an if statement which would be triggered only whenpath_open
was successful.