]> git.ipfire.org Git - pakfire.git/commitdiff
log stream: Reset file descriptors to EBADF
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 16:39:33 +0000 (16:39 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2024 16:39:33 +0000 (16:39 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/log_stream.c

index d212d6f8023a4dfb4a0078caee80f8f22c0dbc91..cd5f6daf73c7d9fc6afee7fa28114629dfb8189f 100644 (file)
@@ -180,7 +180,7 @@ static int __pakfire_log_stream(sd_event_source* s, int fd, uint32_t events, voi
 
                if (stream->pipe[0] >= 0) {
                        close(stream->pipe[0]);
-                       stream->pipe[0] = -1;
+                       stream->pipe[0] = -EBADF;
                }
        }
 
@@ -196,7 +196,7 @@ int pakfire_log_stream_in_parent(struct pakfire_log_stream* stream, sd_event* lo
        // Close the write end of the pipe
        if (stream->pipe[1] >= 0) {
                close(stream->pipe[1]);
-               stream->pipe[1] = -1;
+               stream->pipe[1] = -EBADF;
        }
 
        // Register the file descriptor with the event loop
@@ -217,7 +217,7 @@ int pakfire_log_stream_in_child(struct pakfire_log_stream* stream) {
        // Close the read end of the pipe
        if (stream->pipe[0] >= 0) {
                close(stream->pipe[0]);
-               stream->pipe[0] = -1;
+               stream->pipe[0] = -EBADF;
        }
 
        return 0;