This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Description
Please correct me if I'm wrong, but I think you have a memory issue. In
|
if (fdin) { |
|
if (dup2(*fdin, STDIN_FILENO) < 0) { |
|
PANIC("Could not setup stdin for child process: %s", strerror(errno)); |
|
} |
|
} |
|
|
|
if (fdout) { |
|
if (dup2(*fdout, STDOUT_FILENO) < 0) { |
|
PANIC("Could not setup stdout for child process: %s", strerror(errno)); |
|
} |
|
} |
you de-reference the input fds, but in
you create that on the stack, once for all of them. You overwrite them in each iteration. But afaik you are not guaranteed that the child runs and de-references those pointers before you get to the next command in the loop.