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 | 6991ac8c70869ca19a87cfc173e280cab7ff20d0 (diff) |
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 @@ #include "stringop.h" struct cmd_results *cmd_exec(int argc, char **argv) { - if (!config->active) return cmd_results_new(CMD_DEFER, NULL); + struct cmd_results *error = NULL; + if ((error = cmd_exec_validate(argc, argv))) { + return error; + } if (config->reloading) { char *args = join_args(argv, argc); sway_log(SWAY_DEBUG, "Ignoring 'exec %s' due to reload", args); free(args); return cmd_results_new(CMD_SUCCESS, NULL); } - return cmd_exec_always(argc, argv); + return cmd_exec_process(argc, argv); } |