From 8d5dac70e73bee79f8ce65faac1408fbe341489c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 29 Apr 2009 12:22:01 +0200 Subject: [PATCH] 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. --- box/box.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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); } -- 2.39.2