diff options
author | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-10-19 22:22:29 +0200 |
---|---|---|
committer | Tristan Riehs <tristan.riehs@bordeaux-inp.fr> | 2023-10-19 22:22:29 +0200 |
commit | fb811629ea6bf1837c2ae4de2ffa3f3207b28c75 (patch) | |
tree | d98f3cfb5b5f761c49dc721c777dd7a1f323bc40 | |
parent | ccecf92b8c46d3db1da634fe5cf8a92b226d51f6 (diff) |
trying to redirect stdin
-rw-r--r-- | rpt.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -63,6 +63,22 @@ exec_child(char **argv) { int status; + status = lseek(STDIN_FILENO, 0, L_SET); + + if (status < 0) + { + perror("rpt[child process]"); + exit(4); + } + + status = dup2(dup(clone_fd), STDIN_FILENO); + + if (status < 0) + { + perror("rpt[child process]"); + exit(4); + } + status = execvp(argv[0], argv); if (status < 0) |