From: Martin Mares Date: Wed, 29 Apr 2009 10:22:01 +0000 (+0200) Subject: Hopefully fixed the occasional "UGH" error. X-Git-Tag: python-dummy-working~103 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=8d5dac70e73bee79f8ce65faac1408fbe341489c;p=eval.git Hopefully fixed the occasional "UGH" error. When the machine creaks under high load, SIGALRM can arrive during the final wait4() in box_exit(), causing it to return EINTR. Restart waiting in such cases. --- diff --git a/box/box.c b/box/box.c index 69a2917..3f6ada1 100644 --- a/box/box.c +++ b/box/box.c @@ -121,10 +121,12 @@ box_exit(int rc) meta_printf("killed:1\n"); struct rusage rus; - int stat; - int p = wait4(box_pid, &stat, 0, &rus); + int p, stat; + do + p = wait4(box_pid, &stat, 0, &rus); + while (p < 0 && errno == EINTR); if (p < 0) - fprintf(stderr, "UGH: Lost track of the process\n"); + fprintf(stderr, "UGH: Lost track of the process (%m)\n"); else final_stats(&rus); }