]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/child.c
Use _PATH_BSHELL to ensure using a bourne shell
[i3/i3] / i3bar / src / child.c
index ad93681c65f3d352b085347f802d9dd1aeeb5327..dce0218fd305fda1ee38be246a47cc2e3618f249 100644 (file)
@@ -22,6 +22,7 @@
 #include <yajl/yajl_parse.h>
 #include <yajl/yajl_version.h>
 #include <yajl/yajl_gen.h>
+#include <paths.h>
 
 #include "common.h"
 
@@ -359,7 +360,11 @@ void child_sig_cb(struct ev_loop *loop, ev_child *watcher, int revents) {
 void child_write_output(void) {
     if (child.click_events) {
         const unsigned char *output;
+#if YAJL_MAJOR < 2
+        unsigned int size;
+#else
         size_t size;
+#endif
         yajl_gen_get_buf(gen, &output, &size);
         write(child_stdin, output, size);
         write(child_stdin, "\n", 1);
@@ -388,11 +393,13 @@ void start_child(char *command) {
     yajl_parser_config parse_conf = { 0, 0 };
 
     parser = yajl_alloc(&callbacks, &parse_conf, NULL, (void*)&parser_context);
+
+    gen = yajl_gen_alloc(NULL, NULL);
 #else
     parser = yajl_alloc(&callbacks, NULL, &parser_context);
-#endif
 
     gen = yajl_gen_alloc(NULL);
+#endif
 
     if (command != NULL) {
         int pipe_in[2]; /* pipe we read from */
@@ -417,12 +424,7 @@ void start_child(char *command) {
                 dup2(pipe_in[1], STDOUT_FILENO);
                 dup2(pipe_out[0], STDIN_FILENO);
 
-                static const char *shell = NULL;
-
-                if ((shell = getenv("SHELL")) == NULL)
-                    shell = "/bin/sh";
-
-                execl(shell, shell, "-c", command, (char*) NULL);
+                execl(_PATH_BSHELL, _PATH_BSHELL, "-c", command, (char*) NULL);
                 return;
             default:
                 /* Parent-process. Reroute streams */