From e6c70fde548c22554ea3bdde7e05c3fa99b6c827 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sat, 12 Oct 2024 16:39:11 +0000 Subject: [PATCH] log stream: Avoid infinite loop Signed-off-by: Michael Tremer --- src/libpakfire/log_stream.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/libpakfire/log_stream.c b/src/libpakfire/log_stream.c index 760dcc167..d212d6f80 100644 --- a/src/libpakfire/log_stream.c +++ b/src/libpakfire/log_stream.c @@ -162,24 +162,15 @@ static int __pakfire_log_stream(sd_event_source* s, int fd, uint32_t events, voi int r = -EINVAL; if (events & EPOLLIN) { - for (;;) { - // Fill the buffer - r = pakfire_log_stream_fill_buffer(stream, fd); - if (r < 0) { - switch (-r) { - case EAGAIN: - return 0; - - default: - return r; - } - } - - // Drain the buffer - r = pakfire_log_stream_drain_buffer(stream); - if (r < 0) - return r; - } + // Fill the buffer + r = pakfire_log_stream_fill_buffer(stream, fd); + if (r < 0) + return r; + + // Drain the buffer + r = pakfire_log_stream_drain_buffer(stream); + if (r < 0) + return r; } // Handle if the child process has closed the file descriptor -- 2.47.3