[PATCH] Fix EINTR handling when reading from a pipe.

Ignacy Gawędzki <[email protected]> Thu, 2 Apr 2026 14:41:39 +0200
Newsgroups org.kernel.vger.dash
Message-ID <4k2hzdcp5gi5vgio3njtxttm6lshkzfyl3iz3246yqvx3bdbck@7wb4dopuoxhg>
When using tee to peek at stdin pipe, consider forwarding EINTR
without attempting to read, otherwise signals don't get handled
properly.

Signed-off-by: Ignacy Gawędzki <[email protected]>
---
 src/input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input.c b/src/input.c
index 71282fb..8287b95 100644
--- a/src/input.c
+++ b/src/input.c
@@ -324,7 +324,7 @@ retry:
 	if (!fd && !stdin_bufferable()) {
 		nr = stdin_tee(buf, nr);
 		fd = stdin_state.pip[0];
-		if (nr <= 0) {
+		if (nr <= 0 && errno != EINTR) {
 			fd = 0;
 			nr = 1;
 		}
-- 
2.51.0