From 40c8c828972af044b7628b2c167093f78353fcdd Mon Sep 17 00:00:00 2001 From: John Denker Date: Tue, 17 Jul 2012 13:05:15 -0700 Subject: fix commented-out bug; clarify variable-name --- tools/hi-q.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tools/hi-q.c b/tools/hi-q.c index 7215b0c..237dbd5 100644 --- a/tools/hi-q.c +++ b/tools/hi-q.c @@ -424,7 +424,7 @@ int main(int argc, char** argv) { cerr << endl; } - pid_t special_kid = kidpid[nkids-1]; + pid_t special_pid = kidpid[nkids-1]; int alive(nkids-1); // not counting the special kid int best_blame(0); // best reason, even if not a great reason pid_t argbest_blame(-1); // kid# associated with best blame @@ -432,7 +432,7 @@ int main(int argc, char** argv) { for (;;) { if (alive == 0) break; pid_t somekid = waitpid(-1, &kidstatus, WUNTRACED); - if (somekid == special_kid){ + if (somekid == special_pid){ // do not decrement the "alive" counter // since that only applies to non-special kids if (WIFEXITED(kidstatus)) { @@ -510,13 +510,8 @@ int main(int argc, char** argv) { // now that the envelope information has been transfered, // wait for the last kid in the usual way { - -#ifdef moretesting -fprintf(stderr, "About to wait for kid #%d (%d)\n", - special_kid, kidpid[special_kid]); -#endif for(;;) { - waitpid(special_kid, &kidstatus, WUNTRACED); + waitpid(special_pid, &kidstatus, WUNTRACED); if (WIFEXITED(kidstatus)) { int sts = WEXITSTATUS(kidstatus); cerr << "hi-q ends with status: " << sts << endl; -- cgit v1.2.3