summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoroscar <oscar@win10-64-vm>2024-09-23 23:04:36 +0200
committeroscar <oscar@win10-64-vm>2024-09-30 15:23:07 +0200
commite376a27cf27d453f3b1c2728626950d4c4478f48 (patch)
treebcda8c765bcebaf3902f656c945e3d2bf1fc94b5
parent685ec273ecbb54439ed84474fb96ec847bebb630 (diff)
Fix redirection of read when _FORTIFY_SOURCE is defined
When _FORTIFY_SOURCE is defined mingw-w64 provides an inline definition of read in io.h. This makes our previous redirection to sys_read ineffective. The prototype of sys_read is now required because we don't touch the prototype of read. * nt/inc/ms-w32.h (read): Move the redirection after io.h. Add prototype for sys_read (Bug#73444)
-rw-r--r--nt/inc/ms-w32.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 7212e4d2984..4d721244afe 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -256,8 +256,7 @@ extern void w32_reset_stack_overflow_guard (void);
#define fopen sys_fopen
#define link sys_link
#define localtime sys_localtime
-#undef read
-#define read sys_read
+/* we override read after including io.h, see #73444 */
#define rename sys_rename
#define rmdir sys_rmdir
#define select sys_select
@@ -380,6 +379,11 @@ extern struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
#define fileno _fileno
#endif
+/* Here we override CRT read with our own, see #73444 */
+#undef read
+#define read sys_read
+int sys_read (int, char *, unsigned int);
+
/* Defines that we need that aren't in the standard signal.h. */
#define SIGHUP 1 /* Hang up */
#define SIGQUIT 3 /* Quit process */