[gcr/gnome-41] gcr: Add G_SPAWN_CLOEXEC_PIPES flag to all the g_spawn commands



commit 988ffbeee96fffbad4913687b43b57f4ae6f00c5
Author: Corentin Noël <corentin elementary io>
Date:   Fri Nov 12 23:17:58 2021 +0100

    gcr: Add G_SPAWN_CLOEXEC_PIPES flag to all the g_spawn commands
    
    Allows to avoid races in recent GLib version.

 gcr/gcr-gnupg-process.c     | 2 +-
 gcr/gcr-ssh-agent-process.c | 2 +-
 gcr/test-ssh-askpass.c      | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gcr/gcr-gnupg-process.c b/gcr/gcr-gnupg-process.c
index 20f4a34a..931d48f4 100644
--- a/gcr/gcr-gnupg-process.c
+++ b/gcr/gcr-gnupg-process.c
@@ -1042,7 +1042,7 @@ _gcr_gnupg_process_run_async (GcrGnupgProcess *self, const gchar **argv, const g
        g_free (environ);
 
        g_spawn_async_with_pipes (self->pv->directory, (gchar**)args->pdata,
-                                 (gchar**)envs->pdata, G_SPAWN_DO_NOT_REAP_CHILD,
+                                 (gchar**)envs->pdata, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_CLOEXEC_PIPES,
                                  on_gnupg_process_child_setup, child_fds,
                                  &pid, &input_fd, &output_fd, &error_fd, &error);
 
diff --git a/gcr/gcr-ssh-agent-process.c b/gcr/gcr-ssh-agent-process.c
index 2eb43fbb..77864f2f 100644
--- a/gcr/gcr-ssh-agent-process.c
+++ b/gcr/gcr-ssh-agent-process.c
@@ -181,7 +181,7 @@ agent_start_inlock (GcrSshAgentProcess *self,
        const gchar *argv[] = { SSH_AGENT_EXECUTABLE, "-D", "-a", self->path, NULL };
        GPid pid;
 
-       if (!g_spawn_async_with_pipes ("/", (gchar **)argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD,
+       if (!g_spawn_async_with_pipes ("/", (gchar **)argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | 
G_SPAWN_CLOEXEC_PIPES,
                                       NULL, NULL, &pid, NULL, &self->output, NULL, error))
                return FALSE;
 
diff --git a/gcr/test-ssh-askpass.c b/gcr/test-ssh-askpass.c
index 786ae25d..cd58fcee 100644
--- a/gcr/test-ssh-askpass.c
+++ b/gcr/test-ssh-askpass.c
@@ -81,7 +81,7 @@ test_ssh_keygen (Test *test,
                g_assert_not_reached ();
 
        g_spawn_async (SRCDIR "/gcr/fixtures", argv, NULL,
-                      G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+                      G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | 
G_SPAWN_CLOEXEC_PIPES,
                       gcr_ssh_askpass_child_setup, test->askpass, &pid, &error);
 
        g_free (filename);
@@ -122,7 +122,7 @@ test_cancelled (Test *test,
                g_assert_not_reached ();
 
        g_spawn_async (SRCDIR "/gcr/fixtures", argv, NULL,
-                      G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+                      G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD | 
G_SPAWN_CLOEXEC_PIPES,
                       gcr_ssh_askpass_child_setup, test->askpass, &pid, &error);
 
        g_free (filename);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]