Commit 81e08ecb authored by Raymond Toy's avatar Raymond Toy

Clean up prog_status

 - If `waidpid` returns 0 or -1, we should return.
 - Make the fprintf message a bit clearer on what's happening when we
   have some kind of status that we didn't handle.
parent 99ebe80c
Pipeline #175 passed with stage
in 12 minutes and 40 seconds
......@@ -107,8 +107,7 @@ prog_status(pid_t* pid, int* what, int* code, int* corep)
w = waitpid(-1, &status, WNOHANG | WUNTRACED | WCONTINUED);
*pid = w;
if (w == -1) {
if (w <= 0) {
return;
}
......@@ -129,7 +128,7 @@ prog_status(pid_t* pid, int* what, int* code, int* corep)
*code = 0;
*corep = 0;
} else {
fprintf(stderr, "pid = %d, status = 0x%x\n", *pid, status);
fprintf(stderr, "Unhandled waidpid status: pid = %d, status = 0x%x\n", *pid, status);
}
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment