summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 11:49:04 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-05 11:49:04 +0000
commit5e42cc30855e7f84fb9269421d7710152eb00557 (patch)
tree271e7c03aadc6f54e10ed2d536b6bcb87d6a38e1 /process.c
parent4eed59e667536b77397afdd42823aafa4d8057b2 (diff)
* process.c (handle_fork_error): Don't need state_p argument.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/process.c b/process.c
index dcbb71d..165e769 100644
--- a/process.c
+++ b/process.c
@@ -3159,8 +3159,10 @@ pipe_nocrash(int filedes[2], VALUE fds)
#endif
static int
-handle_fork_error(int *status, int *ep, int *state_p, int *try_gc_p)
+handle_fork_error(int *status, int *ep, int *try_gc_p)
{
+ int state = 0;
+
switch (errno) {
case ENOMEM:
if ((*try_gc_p)-- > 0 && !rb_during_gc()) {
@@ -3177,16 +3179,16 @@ handle_fork_error(int *status, int *ep, int *state_p, int *try_gc_p)
return 0;
}
else {
- rb_protect((VALUE (*)())rb_thread_sleep, 1, state_p);
- if (status) *status = *state_p;
- if (!*state_p) return 0;
+ rb_protect((VALUE (*)())rb_thread_sleep, 1, &state);
+ if (status) *status = state;
+ if (!state) return 0;
}
break;
}
if (ep) {
preserving_errno((close(ep[0]), close(ep[1])));
}
- if (*state_p && !status) rb_jump_tag(*state_p);
+ if (state && !status) rb_jump_tag(state);
return -1;
}
@@ -3388,7 +3390,6 @@ retry_fork_async_signal_safe(int *status, int *ep,
char *errmsg, size_t errmsg_buflen)
{
rb_pid_t pid;
- int state = 0;
int try_gc = 1;
while (1) {
@@ -3416,7 +3417,7 @@ retry_fork_async_signal_safe(int *status, int *ep,
if (0 < pid) /* fork succeed, parent process */
return pid;
/* fork failed */
- if (handle_fork_error(status, ep, &state, &try_gc))
+ if (handle_fork_error(status, ep, &try_gc))
return -1;
}
}
@@ -3458,7 +3459,6 @@ static rb_pid_t
retry_fork_ruby(int *status)
{
rb_pid_t pid;
- int state = 0;
int try_gc = 1;
while (1) {
@@ -3471,7 +3471,7 @@ retry_fork_ruby(int *status)
if (0 < pid) /* fork succeed, parent process */
return pid;
/* fork failed */
- if (handle_fork_error(status, NULL, &state, &try_gc))
+ if (handle_fork_error(status, NULL, &try_gc))
return -1;
}
}