aboutsummaryrefslogtreecommitdiff
path: root/rpt.c
diff options
context:
space:
mode:
Diffstat (limited to 'rpt.c')
-rw-r--r--rpt.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/rpt.c b/rpt.c
index 298f60e..1d1f0cb 100644
--- a/rpt.c
+++ b/rpt.c
@@ -96,13 +96,13 @@ exec_child(char **argv)
}
void
-wait_child(pid_t pid, void (*handle_error_f)(int status))
+wait_child(void (*handle_error_f)(int status))
{
- int exit_status = 0;
+ int wstatus;
- waitpid(pid, &exit_status, 0);
+ wait(&wstatus);
- handle_error_f(exit_status);
+ handle_error_f(WEXITSTATUS(wstatus));
}
void
@@ -119,10 +119,10 @@ invoke_cmd(char **argv, void (*handle_error_f)(int status))
if (pid == 0)
exec_child(argv);
else
- wait_child(pid, handle_error_f);
+ wait_child(handle_error_f);
}
-/* Invoke the executable *ARGV COUNT times, passing it the rest of ARG as
+/* Invoke the executable *ARGV COUNT times, passing it the rest of ARGV as
arguments. Call HANDLE_ERROR_F between each process. */
void
repeat_cmd(char **argv, long count, void (*handle_error_f)(int status))