From fb811629ea6bf1837c2ae4de2ffa3f3207b28c75 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Thu, 19 Oct 2023 22:22:29 +0200 Subject: trying to redirect stdin --- rpt.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rpt.c b/rpt.c index 82e2c95..cf466c0 100644 --- a/rpt.c +++ b/rpt.c @@ -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) -- cgit v1.2.3