chiark / gitweb /
yay, we can start socket units
[elogind.git] / execute.c
index bcaa4e959d580c0d3ed65a9f5615b1e2367f416d..f3b4df930f24f8a768d3b7150c65573efc33f541 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -11,6 +11,7 @@
 #include "strv.h"
 #include "macro.h"
 #include "util.h"
+#include "log.h"
 
 static int close_fds(int except[], unsigned n_except) {
         DIR *d;
@@ -111,6 +112,8 @@ int exec_spawn(const ExecCommand *command, const ExecContext *context, int *fds,
         assert(ret);
         assert(fds || n_fds <= 0);
 
+        log_debug("About to execute %s", command->path);
+
         if ((pid = fork()) < 0)
                 return -errno;
 
@@ -250,7 +253,6 @@ void exec_command_free_array(ExecCommand **c, unsigned n) {
         }
 }
 
-
 void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
         assert(c);
         assert(f);
@@ -286,7 +288,7 @@ char *exec_command_line(ExecCommand *c) {
         assert(c);
         assert(c->argv);
 
-        k = 0;
+        k = 1;
         STRV_FOREACH(a, c->argv)
                 k += strlen(*a)+3;
 
@@ -310,6 +312,8 @@ char *exec_command_line(ExecCommand *c) {
 
         }
 
+        *p = 0;
+
         /* FIXME: this doesn't really handle arguments that have
          * spaces and ticks in them */