From f7d611af7bca45253f775b2ddc2dd5299b03f3fe Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Sun, 8 Sep 2024 18:22:00 +0300 Subject: [PATCH] create an environment pointer for child processes --- sway/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sway/main.c b/sway/main.c index 1c4939aa0..d855de5b5 100644 --- a/sway/main.c +++ b/sway/main.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -30,6 +31,7 @@ static int exit_value = 0; static struct rlimit original_nofile_rlimit = {0}; struct sway_server server = {0}; struct sway_debug debug = {0}; +char **child_envp; void sway_terminate(int exit_code) { if (!server.wl_display) { @@ -348,6 +350,8 @@ int main(int argc, char **argv) { ipc_init(&server); setenv("WAYLAND_DISPLAY", server.socket, true); + // g_get_environ creates a newly-allocated environment buffer + child_envp = g_get_environ(); if (!load_main_config(config_path, false, false)) { sway_terminate(EXIT_FAILURE); goto shutdown; @@ -381,6 +385,7 @@ shutdown: free(config_path); free_config(config); + g_strfreev(child_envp); pango_cairo_font_map_set_default(NULL);