wasmi
wasmi copied to clipboard
WASI: Can't open a file with both truncate and append flags
Compile this snippet with wasi-sdk and run it with wasmi will generate an invalid argument error. It does NOT error on other runtimes like Wasmtime or on native Linux.
$ clang wasmi-creat.c
$ wasmi_cli --dir . a.out
executing File("a.out")::_start() ...
open: Invalid argument
#include <fcntl.h>
#include <stdio.h>
int main(void) {
int fd = open("a", O_CREAT | O_WRONLY | O_APPEND | O_TRUNC);
if (fd == -1) {
perror("open");
return 1;
}
return 0;
}