mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 15:05:19 +00:00
Handle ambiguous fstflags on fd_filestat_set_times (#2892)
It's possible to set both `atim` and `atim_now` in the `fstflags` parameter. Same goes for `mtin` and `mtim_now`. However, it's ambiguous which time should be set in these two cases. This commit checks this and returns `EINVAL`.
This commit is contained in:
parent
6cb2ea4935
commit
bc2d8959dd
|
@ -1891,7 +1891,13 @@ wasmtime_ssp_fd_filestat_set_times(wasm_exec_env_t exec_env,
|
||||||
if ((fstflags
|
if ((fstflags
|
||||||
& ~(__WASI_FILESTAT_SET_ATIM | __WASI_FILESTAT_SET_ATIM_NOW
|
& ~(__WASI_FILESTAT_SET_ATIM | __WASI_FILESTAT_SET_ATIM_NOW
|
||||||
| __WASI_FILESTAT_SET_MTIM | __WASI_FILESTAT_SET_MTIM_NOW))
|
| __WASI_FILESTAT_SET_MTIM | __WASI_FILESTAT_SET_MTIM_NOW))
|
||||||
!= 0)
|
!= 0
|
||||||
|
|| (fstflags
|
||||||
|
& (__WASI_FILESTAT_SET_ATIM | __WASI_FILESTAT_SET_ATIM_NOW))
|
||||||
|
== (__WASI_FILESTAT_SET_ATIM | __WASI_FILESTAT_SET_ATIM_NOW)
|
||||||
|
|| (fstflags
|
||||||
|
& (__WASI_FILESTAT_SET_MTIM | __WASI_FILESTAT_SET_MTIM_NOW))
|
||||||
|
== (__WASI_FILESTAT_SET_MTIM | __WASI_FILESTAT_SET_MTIM_NOW))
|
||||||
return __WASI_EINVAL;
|
return __WASI_EINVAL;
|
||||||
|
|
||||||
struct fd_object *fo;
|
struct fd_object *fo;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user