diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-02 21:37:29 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-03 10:37:35 -0400 |
commit | a7f7d4a488c8d3b2461122765f9904c8a411a583 (patch) | |
tree | 7abee51265a8b9550c62255d0c6649935ee1d6a2 /sway/commands.c | |
parent | Show swaynag on config errors (diff) | |
download | sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.gz sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.zst sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.zip |
Write to swaynag pipe fd directly on config errors
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sway/commands.c b/sway/commands.c index 81e9ea42..364c26da 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -132,6 +132,7 @@ static struct cmd_handler handlers[] = { | |||
132 | static struct cmd_handler config_handlers[] = { | 132 | static struct cmd_handler config_handlers[] = { |
133 | { "default_orientation", cmd_default_orientation }, | 133 | { "default_orientation", cmd_default_orientation }, |
134 | { "swaybg_command", cmd_swaybg_command }, | 134 | { "swaybg_command", cmd_swaybg_command }, |
135 | { "swaynag_command", cmd_swaynag_command }, | ||
135 | { "workspace_layout", cmd_workspace_layout }, | 136 | { "workspace_layout", cmd_workspace_layout }, |
136 | }; | 137 | }; |
137 | 138 | ||
@@ -511,14 +512,11 @@ struct cmd_results *cmd_results_new(enum cmd_status status, | |||
511 | results->input = NULL; | 512 | results->input = NULL; |
512 | } | 513 | } |
513 | if (format) { | 514 | if (format) { |
515 | char *error = malloc(256); | ||
514 | va_list args; | 516 | va_list args; |
515 | va_start(args, format); | 517 | va_start(args, format); |
516 | size_t length = vsnprintf(NULL, 0, format, args) + 1; | ||
517 | char *error = malloc(length); | ||
518 | va_end(args); | ||
519 | va_start(args, format); | ||
520 | if (error) { | 518 | if (error) { |
521 | vsnprintf(error, length, format, args); | 519 | vsnprintf(error, 256, format, args); |
522 | } | 520 | } |
523 | va_end(args); | 521 | va_end(args); |
524 | results->error = error; | 522 | results->error = error; |