gtestdbus: 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.
This commit is contained in:
Maciej S. Szmigiero 2023-02-19 14:45:50 +01:00 committed by Philip Withnall
parent 05d2a1d097
commit dd36ee0abf

View File

@ -50,6 +50,7 @@
#ifdef G_OS_UNIX
#include "glib-unix.h"
#include "glib-unixprivate.h"
#endif
/* -------------------------------------------------------------------------- */
@ -248,7 +249,7 @@ watcher_init (void)
gint pipe_fds[2];
/* fork a child to clean up when we are killed */
if (pipe (pipe_fds) != 0)
if (!g_unix_open_pipe_internal (pipe_fds, TRUE))
{
errsv = errno;
g_warning ("pipe() failed: %s", g_strerror (errsv));