From 2cf4dcd1e2dd02236dd117aa211975bbd9572cd2 Mon Sep 17 00:00:00 2001 From: Jindrich Novy Date: Tue, 10 Feb 2026 19:33:51 +0100 Subject: [PATCH] Fix EAGAIN busy-loop in drain_stdio() Return false on EAGAIN to stop draining instead of looping. Fixes #632 Signed-off-by: Jindrich Novy --- src/ctr_stdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ctr_stdio.c b/src/ctr_stdio.c index 5d7eb5e7..aa0aced1 100644 --- a/src/ctr_stdio.c +++ b/src/ctr_stdio.c @@ -130,8 +130,8 @@ static bool read_stdio(int fd, stdpipe_t pipe, gboolean *eof) return false; } else if (num_read < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { - // Non-blocking mode - no data available, return gracefully - return true; + // Non-blocking mode - no data available, stop draining + return false; } /* Ignore EIO if fd is a tty, since this can happen when the tty is closed while we are reading from it. */