From d211b7d4a9a0ee3d0420a8aade39e9b96fe8c6ce Mon Sep 17 00:00:00 2001 From: slonkazoid Date: Sun, 8 Sep 2024 18:22:14 +0300 Subject: [PATCH] switch to execle and supply child_envp as the environment pointer --- sway/commands/exec_always.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index 8bc1048cd..2773238bf 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "sway/commands.h" #include "sway/config.h" #include "sway/server.h" @@ -14,6 +15,8 @@ #include "log.h" #include "stringop.h" +extern char** child_envp; + struct cmd_results *cmd_exec_validate(int argc, char **argv) { struct cmd_results *error = NULL; if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) { @@ -81,7 +84,7 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) { if (ctx && !no_startup_id) { export_startup_id(ctx); } - execlp("sh", "sh", "-c", cmd, (void *)NULL); + execle("/bin/sh", "sh", "-c", cmd, (void *)NULL, child_envp); sway_log_errno(SWAY_ERROR, "execlp failed"); _exit(1); }