From 83ae0b25acdaf3e54bf5e78b5b37aa62014914d5 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 6 May 2021 13:06:22 +0200
Subject: [PATCH 12/34] linter: block the resizing signal while reading output
 from the linter
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This prevents read() from returning unexpectedly and causing a crash.

This fixes https://savannah.gnu.org/bugs/?60537.
Reported-by: Filips Romāns <frfilips@gmail.com>

Bug existed since version 2.4.2, since the handling of SIGWINCH changed.
---
 src/text.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/text.c b/src/text.c
index e0e29468..2ac52dec 100644
--- a/src/text.c
+++ b/src/text.c
@@ -2647,6 +2647,9 @@ void do_linter(void)
 		return;
 	}
 
+	/* Block resizing signals while reading from the pipe. */
+	block_sigwinch(TRUE);
+
 	/* Read in the returned syntax errors. */
 	totalread = 0;
 	buffersize = pipesize + 1;
@@ -2663,6 +2666,8 @@ void do_linter(void)
 	*pointer = '\0';
 	close(lint_fd[0]);
 
+	block_sigwinch(FALSE);
+
 	/* Process the linter output. */
 	pointer = lintings;
 	onelint = lintings;
-- 
2.29.3

