From fafc8a0b8a3041beb410ed04219c5e20c5f6572f Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sun, 13 Nov 2016 12:45:01 -0500 Subject: [PATCH] Don't retry fork() in a loop. If fork() fails, then report a fatal error. Don't spin the cpu retrying fork() until it succeeds. It can fail when we reach a limit on the number of processes. Spinning on the cpu would slow down other processes when we want them to exit. This would get bad if we had a parallel build with multiple ack processes spinning. --- util/ack/run.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/ack/run.c b/util/ack/run.c index 87d8745a0..6b5b69fcd 100644 --- a/util/ack/run.c +++ b/util/ack/run.c @@ -80,7 +80,10 @@ static int run_exec(trf *phase, const char *prog) { fflush(stdout) ; fflush(stderr) ; - while ( (child=fork())== -1 ) ; + child= fork() ; + if ( child== - 1) { + fatal("Cannot fork %s", prog) ; + } if ( child ) { /* The parent */ do { -- 2.34.1