From: Michael Tremer Date: Sat, 12 Oct 2024 14:53:30 +0000 (+0000) Subject: log stream: Correctly check for open file descriptors X-Git-Tag: 0.9.30~1075 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09f7c247e9865fe0f317ae4612e7fdba28bf1c9f;p=pakfire.git log stream: Correctly check for open file descriptors Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/log_stream.c b/src/libpakfire/log_stream.c index 92f7f41a1..a8f20a675 100644 --- a/src/libpakfire/log_stream.c +++ b/src/libpakfire/log_stream.c @@ -160,7 +160,7 @@ int pakfire_log_stream_in_parent(struct pakfire_log_stream* stream, sd_event* lo int r; // Close the write end of the pipe - if (stream->pipe[1]) { + if (stream->pipe[1] >= 0) { close(stream->pipe[1]); stream->pipe[1] = -1; } @@ -188,7 +188,7 @@ int pakfire_log_stream_in_parent(struct pakfire_log_stream* stream, sd_event* lo */ int pakfire_log_stream_in_child(struct pakfire_log_stream* stream) { // Close the read end of the pipe - if (stream->pipe[0]) { + if (stream->pipe[0] >= 0) { close(stream->pipe[0]); stream->pipe[0] = -1; }