From a2ddcdf67b720412b04c2b7afbb0cc4c674c1248 Mon Sep 17 00:00:00 2001 From: NRK Date: Sun, 8 Mar 2026 01:22:12 +0000 Subject: [PATCH] osdep/io: fix error check _get_osfhandle returns INVALID_HANDLE_VALUE on failure, not 0. --- osdep/io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osdep/io.c b/osdep/io.c index fcaa635d50..cc1a096532 100644 --- a/osdep/io.c +++ b/osdep/io.c @@ -815,7 +815,7 @@ void *mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) mp_assert(flags == MAP_SHARED); // not implemented HANDLE osf = (HANDLE)_get_osfhandle(fd); - if (!osf) { + if (osf == INVALID_HANDLE_VALUE) { errno = EBADF; return MAP_FAILED; }