commit c4ffd734e441eab72fea517c6b8a5744c9e4b069
parent 9c1c0171de2507aa2b8724e6b451c354b88810ba
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Sun, 16 Aug 2026 19:18:34 +0200
mhd_read_file: fixed EOF detection on W32, minor formatting
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/src/mhd2/mhd_read_file.c b/src/mhd2/mhd_read_file.c
@@ -44,7 +44,7 @@
#include "mhd_sys_options.h"
-#include "mhd_read_file.h"
+#include "mhd_assert.h"
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
@@ -60,6 +60,8 @@
# include <io.h> /* for _get_osfhandle() */
#endif
+#include "mhd_read_file.h"
+
MHD_INTERNAL MHD_FN_MUST_CHECK_RESULT_ MHD_FN_PAR_NONNULL_ALL_
MHD_FN_PAR_OUT_SIZE_ (4, 3) MHD_FN_PAR_OUT_ (5) enum mhd_FileReadResult
mhd_read_file (int file_fd,
@@ -181,10 +183,11 @@ mhd_read_file (int file_fd,
reqReadSize,
&resReadSize,
&ovrlp))
- return mhd_FILE_READ_ERROR;
-
- if (0 == resReadSize)
- return mhd_FILE_READ_EOF;
+ {
+ return (ERROR_HANDLE_EOF == GetLastError ()) ?
+ mhd_FILE_READ_EOF : mhd_FILE_READ_ERROR;
+ }
+ mhd_assert (0 != resReadSize);
*size_filled = resReadSize;
return mhd_FILE_READ_OK;