From 124b1f1248365cc8d191c085eac251a4a9548a5a Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Sun, 8 Sep 2024 18:22:06 +0300 Subject: [PATCH] act on child_envp instead of global environment variables --- sway/commands/env.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sway/commands/env.c b/sway/commands/env.c index 2603f257a..e221fab76 100644 --- a/sway/commands/env.c +++ b/sway/commands/env.c @@ -1,14 +1,17 @@ #define _POSIX_C_SOURCE 200809L #include +#include #include "sway/commands.h" +extern char **child_envp; + struct cmd_results *cmd_env(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, "env", EXPECTED_EQUAL_TO, 2))) { return error; } - setenv(argv[0], argv[1], 1); + child_envp = g_environ_setenv(child_envp, argv[0], argv[1], 1); return cmd_results_new(CMD_SUCCESS, NULL); }