From: Michael Tremer Date: Sat, 12 Oct 2024 16:39:11 +0000 (+0000) Subject: log stream: Avoid infinite loop X-Git-Tag: 0.9.30~1071 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6c70fde548c22554ea3bdde7e05c3fa99b6c827;p=pakfire.git log stream: Avoid infinite loop Signed-off-by: Michael Tremer --- 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