diff --git a/execute.c b/execute.c index f0c4f87..37269fb 100755 --- a/execute.c +++ b/execute.c @@ -143,15 +143,7 @@ static void run_child(int fd_send_filename, const char* tmpdir) { int outfd; int err; struct timeval starttv; - char *cmd; - int cmdLen = 0; - - for (int i = 0; i < command_line.command.num; cmdLen += strlen(command_line.command.array[i++]) + 1); - cmd = malloc(cmdLen * sizeof(char) + 1); - for (int i = 0; i < command_line.command.num; i++) { - strcat(cmd, command_line.command.array[i]); - strcat(cmd, " "); - } + char *cmd = build_command_string(); if (command_line.logfile) { outfname = malloc(1 + strlen(command_line.logfile) + strlen(".XXXXXX") + 1);