Merge branch 't/periodic_header_optional'
[paraslash.git] / exec.c
diff --git a/exec.c b/exec.c
index 86a483cfd8e704eda8907d7399e891f603633393..b11b217b963fd2359622d5f56688c7f51e80b766 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -1,16 +1,19 @@
 /*
- * Copyright (C) 2003-2009 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2003-2011 Andre Noll <maan@systemlinux.org>
  *
  * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
 /** \file exec.c Helper functions for spawning new processes. */
+
+#include <regex.h>
 #include <dirent.h>
+
 #include "para.h"
 #include "close_on_fork.h"
 #include "error.h"
-#include "string.h"
 #include "fd.h"
+#include "string.h"
 
 /**
  * Spawn a new process and redirect fd 0, 1, and 2.
@@ -137,11 +140,11 @@ int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds)
 {
        int ret;
        char **argv;
-       char *tmp = para_strdup(cmdline);
 
-       split_args(tmp, &argv, " \t");
+       ret = create_argv(cmdline, " \t", &argv);
+       if (ret < 0)
+               return ret;
        ret = para_exec(pid, argv[0], argv, fds);
-       free(argv);
-       free(tmp);
+       free_argv(argv);
        return ret;
 }