- } else if (forkret == 0) {
- /* child - pipe out */
- if (close(child_out[0]) == -1) {
- perror("error closing pipe?!? for child OUT[READFD]");
- exit(1);
- }
- if (dup2(child_out[1], 1) == -1) {
- perror("(child) dup2 of fdout onto STDOUT failed!");
- }
-
- /* Close extra copies */
- if (close(child_out[1]) == -1) {
- perror("error closing pipe?!? for child OUT[WRITEFD]");
- exit(1);
- }
-
- /* child - pipe in */
- if (close(child_in[1]) == -1) {
- perror("error closing pipe?!? for child IN[WRITEFD]");
- exit(1);
- }
- if (dup2(child_in[0], 0) == -1) {
- perror("(child) dup2 of fdin onto STDIN failed!");
- }
-
- /* Close extra copies */
- if (close(child_in[0]) == -1) {
- perror("error closing pipe?!? for child IN[READFD]");
- exit(1);
- }