Skip to content

Commit

Permalink
wasi: make fdstat_set_flags return ENOTSUP for unimplemented flags
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Nov 30, 2023
1 parent 7e75952 commit bfda20f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libwasi/wasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1437,12 +1437,15 @@ wasi_fd_fdstat_set_flags(struct exec_context *ctx, struct host_instance *hi,
uint32_t fdflags = HOST_FUNC_PARAM(ft, params, 1, i32);
struct wasi_fdinfo *fdinfo = NULL;
int ret;
if ((fdflags & ~WASI_FDFLAG_NONBLOCK) != 0) {
ret = ENOTSUP;
goto fail;
}
ret = wasi_fd_lookup(wasi, wasifd, &fdinfo);
if (ret != 0) {
goto fail;
}
fdinfo->blocking = ((fdflags & WASI_FDFLAG_NONBLOCK) == 0);
/* TODO implement other flags */
fail:
wasi_fdinfo_release(wasi, fdinfo);
HOST_FUNC_RESULT_SET(ft, results, 0, i32, wasi_convert_errno(ret));
Expand Down

0 comments on commit bfda20f

Please sign in to comment.