aboutsummaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'process.c')
-rw-r--r--process.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/process.c b/process.c
index 41804166d2..e3f4f35892 100644
--- a/process.c
+++ b/process.c
@@ -2766,9 +2766,13 @@ retry_fork(int *status, int *ep)
rb_io_flush(rb_stderr) \
)
- prefork();
- for (; before_fork(), (pid = fork()) < 0; prefork()) {
- after_fork();
+ while (1) {
+ prefork();
+ before_fork();
+ pid = fork();
+ if (0 <= pid)
+ break;
+ after_fork();
switch (errno) {
case EAGAIN:
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN