Skip to content
Snippets Groups Projects
Commit 81e08ecb authored by Raymond Toy's avatar Raymond Toy
Browse files

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
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment