Dont close original file handle, we may need it later.
This commit is contained in:
parent
3b9fc8fe2a
commit
20872be9a4
@ -36,15 +36,16 @@ extern int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_f
|
|||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
/* child process */
|
/* child process */
|
||||||
close(fd_pipe[0]); /* We don't wan't to read from the pipe */
|
close(fd_pipe[0]); /* We don't wan't to read from the parent */
|
||||||
transformer(src_fd, fd_pipe[1]);
|
transformer(src_fd, fd_pipe[1]);
|
||||||
close(fd_pipe[1]); /* Send EOF */
|
close(fd_pipe[1]); /* Send EOF */
|
||||||
|
close(src_fd);
|
||||||
exit(0);
|
exit(0);
|
||||||
/* notreached */
|
/* notreached */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parent process */
|
/* parent process */
|
||||||
close(fd_pipe[1]); /* Don't want to write down the pipe */
|
close(fd_pipe[1]); /* Don't want to write to the child */
|
||||||
close(src_fd);
|
|
||||||
|
|
||||||
return(fd_pipe[0]);
|
return(fd_pipe[0]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user