diff options
author | Konstantin Pospelov <kupospelov@gmail.com> | 2020-08-23 13:59:22 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-08-24 09:41:54 +0200 |
commit | fd216b3a81129f15036755bc6f383c7c261291a5 (patch) | |
tree | a45ac5163ffa90fca8a3a03ef0b563f9829e4345 /sway/commands/exec.c | |
parent | Handle SIGINT (diff) | |
download | sway-fd216b3a81129f15036755bc6f383c7c261291a5.tar.gz sway-fd216b3a81129f15036755bc6f383c7c261291a5.tar.zst sway-fd216b3a81129f15036755bc6f383c7c261291a5.zip |
exec: fix validation during config reload
Split cmd_exec_always into separate methods for general validation and
process creation. This fixes a potential call of join_args with 0 arguments.
Diffstat (limited to 'sway/commands/exec.c')
-rw-r--r-- | sway/commands/exec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sway/commands/exec.c b/sway/commands/exec.c index 87d90716..2c6f3d2d 100644 --- a/sway/commands/exec.c +++ b/sway/commands/exec.c | |||
@@ -5,12 +5,15 @@ | |||
5 | #include "stringop.h" | 5 | #include "stringop.h" |
6 | 6 | ||
7 | struct cmd_results *cmd_exec(int argc, char **argv) { | 7 | struct cmd_results *cmd_exec(int argc, char **argv) { |
8 | if (!config->active) return cmd_results_new(CMD_DEFER, NULL); | 8 | struct cmd_results *error = NULL; |
9 | if ((error = cmd_exec_validate(argc, argv))) { | ||
10 | return error; | ||
11 | } | ||
9 | if (config->reloading) { | 12 | if (config->reloading) { |
10 | char *args = join_args(argv, argc); | 13 | char *args = join_args(argv, argc); |
11 | sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args); | 14 | sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args); |
12 | free(args); | 15 | free(args); |
13 | return cmd_results_new(CMD_SUCCESS, NULL); | 16 | return cmd_results_new(CMD_SUCCESS, NULL); |
14 | } | 17 | } |
15 | return cmd_exec_always(argc, argv); | 18 | return cmd_exec_process(argc, argv); |
16 | } | 19 | } |