From ffa8edca7bb60ed06f23f769a5fac723b3bc020d Mon Sep 17 00:00:00 2001 From: Arthur Miller Date: Thu, 22 Feb 2024 00:02:51 +0100 Subject: [PATCH] Check for actuall errno && ignore EINTR --- nt/cmdproxy.c | 3 +++ src/sysdep.c | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c index 0500b653bb2..82592404d4c 100644 --- a/nt/cmdproxy.c +++ b/nt/cmdproxy.c @@ -38,6 +38,9 @@ #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..5d294ca1bdf 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -2981,7 +2981,7 @@ close_output_streams (void) fflush (stderr); fflush (stdout); #else /* !__ANDROID__ */ - if (close_stream (stdout) != 0) + if (close_stream (stdout) != 0 && errno && (errno != EINTR)) { emacs_perror ("Write error to standard output"); _exit (EXIT_FAILURE); @@ -2993,7 +2993,10 @@ close_output_streams (void) if (err | (ADDRESS_SANITIZER ? fflush (stderr) != 0 || ferror (stderr) : close_stream (stderr) != 0)) - _exit (EXIT_FAILURE); + { + if (errno && (errno != EINTR)) + _exit (EXIT_FAILURE); + } #endif /* __ANDROID__ */ } -- 2.43.2