From 22ea9383e28fff60c9880d7d8e6c5102bb43a8d7 Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Tue, 13 Feb 2024 19:35:20 +0100 Subject: [PATCH] Compile with mingw UCRT runtime. --- nt/cmdproxy.c | 4 ++++ src/sysdep.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c index 0500b653bb2..59ffe2c4db7 100644 --- a/nt/cmdproxy.c +++ b/nt/cmdproxy.c @@ -38,6 +38,10 @@ #define DEFER_MS_W32_H #include /* strlen */ #include /* isspace, isalpha */ +#ifdef _UCRT +#define _snprintf snprintf +#endif + /* We don't want to include stdio.h because we are already duplicating lots of it here */ extern int _snprintf (char *buffer, size_t count, const char *format, ...); diff --git a/src/sysdep.c b/src/sysdep.c index 3a6829dd27a..9adff04d45f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2983,8 +2983,10 @@ close_output_streams (void) #else /* !__ANDROID__ */ if (close_stream (stdout) != 0) { +#ifndef _UCRT emacs_perror ("Write error to standard output"); _exit (EXIT_FAILURE); +#endif } /* Do not close stderr if addresses are being sanitized, as the @@ -2993,7 +2995,11 @@ close_output_streams (void) if (err | (ADDRESS_SANITIZER ? fflush (stderr) != 0 || ferror (stderr) : close_stream (stderr) != 0)) +#ifndef _UCRT _exit (EXIT_FAILURE); +#else + ; +#endif #endif /* __ANDROID__ */ } -- 2.43.1