Skip to content

Commit

Permalink
fixed a bug when command is long (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
justanhduc committed Oct 19, 2022
1 parent 2b8525a commit df8d3a9
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df8d3a9

Please sign in to comment.