From 31fd8f60cf21ab8fca232ef0d2dcd65f71b1c03e Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 3 Apr 2023 19:38:00 +0200 Subject: [PATCH] all: use G_SPAWN_CLOEXEC_PIPES with g_spawn_async_with_pipes() G_SPAWN_CLOEXEC_PIPES is supported since glib 2.40, which we already depend on. --- src/core/dns/nm-dns-manager.c | 2 +- src/core/nm-core-utils.c | 2 +- src/libnm-client-test/nm-test-utils-impl.c | 3 ++- src/libnmc-base/nm-polkit-listener.c | 2 +- src/libnmc-base/nm-secret-agent-simple.c | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/dns/nm-dns-manager.c b/src/core/dns/nm-dns-manager.c index 6ee2e816a..fb65afcad 100644 --- a/src/core/dns/nm-dns-manager.c +++ b/src/core/dns/nm-dns-manager.c @@ -647,7 +647,7 @@ run_netconfig(NMDnsManager *self, GError **error, int *stdin_fd) if (!g_spawn_async_with_pipes(NULL, argv, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, + G_SPAWN_CLOEXEC_PIPES | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, diff --git a/src/core/nm-core-utils.c b/src/core/nm-core-utils.c index 175a1652e..4a028e8be 100644 --- a/src/core/nm-core-utils.c +++ b/src/core/nm-core-utils.c @@ -5108,7 +5108,7 @@ nm_utils_spawn_helper(const char *const *args, if (!g_spawn_async_with_pipes("/", (char **) NM_MAKE_STRV(LIBEXECDIR "/nm-daemon-helper"), (char **) NM_MAKE_STRV(), - G_SPAWN_DO_NOT_REAP_CHILD, + G_SPAWN_CLOEXEC_PIPES | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &info->pid, diff --git a/src/libnm-client-test/nm-test-utils-impl.c b/src/libnm-client-test/nm-test-utils-impl.c index ad642d253..ba541ad83 100644 --- a/src/libnm-client-test/nm-test-utils-impl.c +++ b/src/libnm-client-test/nm-test-utils-impl.c @@ -107,7 +107,8 @@ nmtstc_service_init(void) g_spawn_async_with_pipes(NULL, (char **) args, NULL, - G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, + G_SPAWN_CLOEXEC_PIPES | G_SPAWN_SEARCH_PATH + | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &info->pid, diff --git a/src/libnmc-base/nm-polkit-listener.c b/src/libnmc-base/nm-polkit-listener.c index fbc2c7046..7b0de39bc 100644 --- a/src/libnmc-base/nm-polkit-listener.c +++ b/src/libnmc-base/nm-polkit-listener.c @@ -514,7 +514,7 @@ begin_authentication(AuthRequest *request) if (!g_spawn_async_with_pipes(NULL, (char **) helper_argv, NULL, - G_SPAWN_STDERR_TO_DEV_NULL, + G_SPAWN_CLOEXEC_PIPES | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, diff --git a/src/libnmc-base/nm-secret-agent-simple.c b/src/libnmc-base/nm-secret-agent-simple.c index d35ffd797..1b9aa5714 100644 --- a/src/libnmc-base/nm-secret-agent-simple.c +++ b/src/libnmc-base/nm-secret-agent-simple.c @@ -787,7 +787,7 @@ try_spawn_vpn_auth_helper(RequestData *request, GPtrArray *secrets) if (!g_spawn_async_with_pipes(NULL, (char **) auth_dialog_argv->pdata, NULL, - G_SPAWN_DO_NOT_REAP_CHILD, + G_SPAWN_CLOEXEC_PIPES | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &auth_dialog_pid,