aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/exec_always.c
diff options
context:
space:
mode:
authorLibravatar Nicolas Braud-Santoni <nicolas@braud-santoni.eu>2018-05-02 12:33:16 +0200
committerLibravatar Nicolas Braud-Santoni <nicolas@braud-santoni.eu>2018-05-05 17:22:46 +0200
commit177c67e6b89404d9d477b82c00c1353cd4696096 (patch)
tree454ab0043e10090971a1f91ad41f7a6a8395d0bb /sway/commands/exec_always.c
parentMeson: Replace option `instlibdir` with `libexecdir` (diff)
downloadsway-177c67e6b89404d9d477b82c00c1353cd4696096.tar.gz
sway-177c67e6b89404d9d477b82c00c1353cd4696096.tar.zst
sway-177c67e6b89404d9d477b82c00c1353cd4696096.zip
command/exec_always: Use wlr_log for logging errors in the child process
Diffstat (limited to 'sway/commands/exec_always.c')
-rw-r--r--sway/commands/exec_always.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index aaee940b..b3078640 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -11,6 +11,7 @@
11#include "log.h" 11#include "log.h"
12#include "stringop.h" 12#include "stringop.h"
13 13
14
14struct cmd_results *cmd_exec_always(int argc, char **argv) { 15struct cmd_results *cmd_exec_always(int argc, char **argv) {
15 struct cmd_results *error = NULL; 16 struct cmd_results *error = NULL;
16 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL); 17 if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
@@ -62,7 +63,8 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
62 size_t n = confstr(_CS_PATH, NULL, 0); 63 size_t n = confstr(_CS_PATH, NULL, 0);
63 path = malloc(n + extra_size); 64 path = malloc(n + extra_size);
64 if (!path) { 65 if (!path) {
65 return cmd_results_new(CMD_FAILURE, "exec_always", "Unable to allocate PATH"); 66 wlr_log(L_ERROR, "exec_always: Unable to allocate PATH");
67 exit(EXIT_FAILURE);
66 } 68 }
67 confstr(_CS_PATH, path, n); 69 confstr(_CS_PATH, path, n);
68 70
@@ -70,7 +72,8 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
70 size_t n = strlen(path) + 1; 72 size_t n = strlen(path) + 1;
71 char *tmp = malloc(n + extra_size); 73 char *tmp = malloc(n + extra_size);
72 if (!tmp) { 74 if (!tmp) {
73 return cmd_results_new(CMD_FAILURE, "exec_always", "Unable to allocate PATH"); 75 wlr_log(L_ERROR, "exec_always: Unable to allocate PATH");
76 exit(EXIT_FAILURE);
74 } 77 }
75 78
76 strncpy(tmp, path, n); 79 strncpy(tmp, path, n);
@@ -81,7 +84,8 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
81 strcat(path, extra_path); 84 strcat(path, extra_path);
82 if (!setenv("PATH", path, 1)) { 85 if (!setenv("PATH", path, 1)) {
83 free(path); 86 free(path);
84 return cmd_results_new(CMD_FAILURE, "exec_always", "Unable to set PATH"); 87 wlr_log(L_ERROR, "exec_always: Unable to set PATH");
88 exit(EXIT_FAILURE);
85 } 89 }
86 free(path); 90 free(path);
87 91