Fix posix_fadvise error handling

`posix_fadvise()` returns 0 on success and the errno on error.  This
commit fixes the handling of the return value such that it does not
always succeeds.

fixes #3322
This commit is contained in:
Yage Hu 2024-04-16 18:46:52 -07:00
parent 30426be82c
commit e52119329d
No known key found for this signature in database
GPG Key ID: 586BD4CB00BD6021

View File

@ -823,7 +823,7 @@ os_fadvise(os_file_handle handle, __wasi_filesize_t offset,
int ret = posix_fadvise(handle, (off_t)offset, (off_t)length, nadvice); int ret = posix_fadvise(handle, (off_t)offset, (off_t)length, nadvice);
if (ret < 0) if (ret != 0)
return convert_errno(ret); return convert_errno(ret);
return __WASI_ESUCCESS; return __WASI_ESUCCESS;