From 05d2a1d09757feb1aea2926ce7f205a4aa1e2d7f Mon Sep 17 00:00:00 2001 From: "Maciej S. Szmigiero" Date: Sun, 19 Feb 2023 14:44:28 +0100 Subject: [PATCH] gbacktrace: Use g_unix_open_pipe_internal () for creating pipes This attempts to create the pipes with race-free setting of the close-on-exec flag. --- glib/gbacktrace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c index 9c52a7d29..b708b1636 100644 --- a/glib/gbacktrace.c +++ b/glib/gbacktrace.c @@ -45,6 +45,7 @@ #include #ifdef G_OS_UNIX +#include "glib-unixprivate.h" #include #include #include @@ -397,7 +398,8 @@ stack_trace (const char * const *args) stack_trace_done = FALSE; signal (SIGCHLD, stack_trace_sigchld); - if ((pipe (in_fd) == -1) || (pipe (out_fd) == -1)) + if (!g_unix_open_pipe_internal (in_fd, TRUE) || + !g_unix_open_pipe_internal (out_fd, TRUE)) { perror ("unable to open pipe"); _exit (0);