summaryrefslogtreecommitdiff
path: root/glib/gbacktrace.c
diff options
context:
space:
mode:
authorMaciej S. Szmigiero <maciej.szmigiero@oracle.com>2023-02-19 14:44:28 +0100
committerPhilip Withnall <pwithnall@endlessos.org>2023-02-21 12:42:55 +0000
commit05d2a1d09757feb1aea2926ce7f205a4aa1e2d7f (patch)
treea98278e4644c2dc260a6681d83982b36643cf98e /glib/gbacktrace.c
parent14b5207bfa40ab6419abc145680dcfbf190c78bb (diff)
downloadglib-05d2a1d09757feb1aea2926ce7f205a4aa1e2d7f.tar.gz
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.
Diffstat (limited to 'glib/gbacktrace.c')
-rw-r--r--glib/gbacktrace.c4
1 files changed, 3 insertions, 1 deletions
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 <time.h>
#ifdef G_OS_UNIX
+#include "glib-unixprivate.h"
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
@@ -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);