Brendan Shanks : ntdll: Always use MAP_FAILED as mmap()'s error value.

Alexandre Julliard julliard at winehq.org
Fri Feb 12 14:37:37 CST 2021


Module: wine
Branch: master
Commit: b79b158d6b29a6e9fc8ce49446cc349339bd953d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b79b158d6b29a6e9fc8ce49446cc349339bd953d

Author: Brendan Shanks <bshanks at codeweavers.com>
Date:   Thu Feb 11 21:37:51 2021 -0800

ntdll: Always use MAP_FAILED as mmap()'s error value.

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/virtual.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c
index 26a3ca0d2dd..e0346a28ea3 100644
--- a/dlls/ntdll/unix/virtual.c
+++ b/dlls/ntdll/unix/virtual.c
@@ -1807,7 +1807,7 @@ static NTSTATUS map_file_into_view( struct file_view *view, int fd, size_t start
     /* only try mmap if media is not removable (or if we require write access) */
     if (!removable || (flags & MAP_SHARED))
     {
-        if (mmap( (char *)view->base + start, size, prot, flags, fd, offset ) != (void *)-1)
+        if (mmap( (char *)view->base + start, size, prot, flags, fd, offset ) != MAP_FAILED)
             goto done;
 
         switch (errno)
@@ -1970,7 +1970,7 @@ static NTSTATUS map_pe_header( void *ptr, size_t size, int fd, BOOL *removable )
 
     if (!*removable)
     {
-        if (mmap( ptr, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, fd, 0 ) != (void *)-1)
+        if (mmap( ptr, size, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, fd, 0 ) != MAP_FAILED)
             return STATUS_SUCCESS;
 
         switch (errno)




More information about the wine-cvs mailing list