diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-12-07 09:13:02 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-12-07 09:13:02 -0500 |
commit | 79e6c7dcc896a2cff9ddf64ea5e193ddea6aec88 (patch) | |
tree | c7b49a7d04061c9cb947b882ce94e7d5c85d8976 /jobs.c | |
parent | 53ac45a3eb74f5acbc24458a51724c9db80acc55 (diff) | |
download | bash-79e6c7dcc896a2cff9ddf64ea5e193ddea6aec88.tar.gz |
commit bash-20070920 snapshot
Diffstat (limited to 'jobs.c')
-rw-r--r-- | jobs.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -1674,6 +1674,7 @@ make_child (command, async_p) char *command; int async_p; { + int forksleep; sigset_t set, oset; pid_t pid; @@ -1695,8 +1696,16 @@ make_child (command, async_p) sync_buffered_stream (default_buffered_input); #endif /* BUFFERED_INPUT */ - /* Create the child, handle severe errors. */ - if ((pid = fork ()) < 0) + /* Create the child, handle severe errors. Retry on EAGAIN. */ + while ((pid = fork ()) < 0 && errno == EAGAIN && forksleep < FORKSLEEP_MAX) + { + sys_error ("fork: retry"); + if (sleep (forksleep) != 0) + break; + forksleep <<= 1; + } + + if (pid < 0) { sys_error ("fork"); |