From 9367f8dda480cb1f6e182ccfa6130421473bba57 Mon Sep 17 00:00:00 2001 From: Roger Moschiel Date: Sat, 14 Dec 2024 11:45:15 -0300 Subject: [PATCH] replace 'waitpid' to 'wait' as requested on assignment --- examples/systemcalls/systemcalls.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/systemcalls/systemcalls.c b/examples/systemcalls/systemcalls.c index 82c1af5..bacc10e 100644 --- a/examples/systemcalls/systemcalls.c +++ b/examples/systemcalls/systemcalls.c @@ -108,7 +108,8 @@ bool do_exec(int count, ...) } else { // This is the parent process // wait for the child to finish - if (waitpid(pid, &status, 0) == -1) { + //if (waitpid(pid, &status, 0) == -1) { + if (wait(&status) == -1) { fprintf(stderr, "parent: waitpid failed"); pass = false; } else if(WIFEXITED(status)) { @@ -204,7 +205,8 @@ bool do_exec_redirect(const char *outputfile, int count, ...) } else { // This is the parent process // wait for the child to finish - if (waitpid(pid, &status, 0) == -1) { + //if (waitpid(pid, &status, 0) == -1) { + if (wait(&status) == -1) { fprintf(stderr, "parent: waitpid failed"); pass = false; } else if(WIFEXITED(status)) {