mirror of
https://github.com/swaywm/sway.git
synced 2025-01-31 05:06:45 +00:00
create an environment pointer for child processes
This commit is contained in:
parent
8830b1f992
commit
f7d611af7b
|
@ -1,5 +1,6 @@
|
|||
#include <getopt.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include <glib.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue