Procházet zdrojové kódy

Fix posix_fadvise error handling (#3323)

`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.
Yage Hu před 2 roky
rodič
revize
d39d2ba3ca
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      core/shared/platform/common/posix/posix_file.c

+ 1 - 1
core/shared/platform/common/posix/posix_file.c

@@ -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;