From d4242177daaee9078245570125c5a99e65f55163 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 7 Nov 2020 11:19:44 +0200 Subject: [PATCH] Fix 'send-string-to-terminal' writing very long strings * src/dispnew.c (Fsend_string_to_terminal): Prevent partial writes by blocking SIGIO while 'fwrite' runs. (Bug#44320) --- src/dispnew.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dispnew.c b/src/dispnew.c index 5b6fa51a563..df55b32c718 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -5904,8 +5904,12 @@ when TERMINAL is nil. */) } out = tty->output; } + /* STRING might be very long, in which case fwrite could be + interrupted by SIGIO. So we temporarily block SIGIO. */ + unrequest_sigio (); fwrite (SDATA (string), 1, SBYTES (string), out); fflush (out); + request_sigio (); unblock_input (); return Qnil; } -- 2.39.2