From 81e08ecbdbbafb9ee29a4013bb3a3a1f25c70118 Mon Sep 17 00:00:00 2001 From: Raymond Toy <toy.raymond@gmail.com> Date: Sat, 16 Sep 2017 14:49:33 -0700 Subject: [PATCH] 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. --- src/lisp/runprog.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lisp/runprog.c b/src/lisp/runprog.c index 852584a83..556c34e0b 100644 --- a/src/lisp/runprog.c +++ b/src/lisp/runprog.c @@ -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; -- GitLab