diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index c096511c95..09aa7bac6e 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -1901,31 +1901,20 @@ wasmtime_ssp_path_open(wasm_exec_env_t exec_env, struct fd_table *curfds, needed_base |= __WASI_RIGHT_PATH_FILESTAT_SET_SIZE; } + // It's not clear whether we want to support these flags in the standard + // yet: https://github.com/WebAssembly/wasi-filesystem/issues/98 so disable + // them in the meanwhile. + if (((fs_flags & __WASI_FDFLAG_DSYNC) != 0) + || ((fs_flags & __WASI_FDFLAG_RSYNC) != 0) + || ((fs_flags & __WASI_FDFLAG_SYNC) != 0)) { + return __WASI_ENOTSUP; + } + // Convert file descriptor flags. if ((fs_flags & __WASI_FDFLAG_APPEND) != 0) noflags |= O_APPEND; - if ((fs_flags & __WASI_FDFLAG_DSYNC) != 0) { -#ifdef O_DSYNC - noflags |= O_DSYNC; -#else - noflags |= O_SYNC; -#endif - needed_inheriting |= __WASI_RIGHT_FD_DATASYNC; - } if ((fs_flags & __WASI_FDFLAG_NONBLOCK) != 0) noflags |= O_NONBLOCK; - if ((fs_flags & __WASI_FDFLAG_RSYNC) != 0) { -#ifdef O_RSYNC - noflags |= O_RSYNC; -#else - noflags |= O_SYNC; -#endif - needed_inheriting |= __WASI_RIGHT_FD_SYNC; - } - if ((fs_flags & __WASI_FDFLAG_SYNC) != 0) { - noflags |= O_SYNC; - needed_inheriting |= __WASI_RIGHT_FD_SYNC; - } if (write && (noflags & (O_APPEND | O_TRUNC)) == 0) needed_inheriting |= __WASI_RIGHT_FD_SEEK;