Skip to content

Commit

Permalink
Fix posix_fadvise error handling (#3323)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
yagehu committed Apr 17, 2024
1 parent 30426be commit d39d2ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/shared/platform/common/posix/posix_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

if (ret < 0)
if (ret != 0)
return convert_errno(ret);

return __WASI_ESUCCESS;
Expand Down

0 comments on commit d39d2ba

Please sign in to comment.