Version of emscripten/emsdk:
POSIX: fdatasync() on an invalid fd must return -1 with errno set. Under WASMFS where -sWASMFS=1, fdatasync() returns a positive value and leaves errno = 0.
Failing command line in full:
$ emcc -O0 -Wall -sWASMFS=1 fdatasync.c -o a.out.js
$ node a.out.js
fdatasync(9999): ret=8 errno=0
The same program on native Linux prints fdatasync(9999): ret=-1 errno=9. Default emcc builds also print fdatasync(9999): ret=-1 errno=8.
Example code snippet:
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
int main(void) {
errno = 0;
int r = fdatasync(9999);
printf("fdatasync(9999): ret=%d errno=%d\n", r, errno);
return (r == -1) ? 0 : 1;
}
Version of emscripten/emsdk:
POSIX:
fdatasync()on an invalid fd must return-1with errno set. Under WASMFS where-sWASMFS=1,fdatasync()returns a positive value and leaveserrno = 0.Failing command line in full:
The same program on native Linux prints
fdatasync(9999): ret=-1 errno=9. Default emcc builds also printfdatasync(9999): ret=-1 errno=8.Example code snippet: