summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--process.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7f5f66ffa3..b0ef5a5bcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sat Jun 9 23:57:03 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_err): rewrite a complex "if" statement.
+
Sat Jun 9 23:44:29 2012 Tanaka Akira <akr@fsij.org>
* process.c (before_exec_async_signal_safe): extracted from
diff --git a/process.c b/process.c
index f7348533b1..87e57078a0 100644
--- a/process.c
+++ b/process.c
@@ -2900,13 +2900,15 @@ rb_fork_err(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALU
return pid;
if (!pid) {
struct chfunc_protect_t arg;
+ int ret;
forked_child = 1;
close(ep[0]);
arg.chfunc = chfunc;
arg.arg = charg;
arg.errmsg = errmsg;
arg.buflen = errmsg_buflen;
- if (!(int)rb_protect(chfunc_protect, (VALUE)&arg, &state)) _exit(EXIT_SUCCESS);
+ ret = (int)rb_protect(chfunc_protect, (VALUE)&arg, &state);
+ if (!ret) _exit(EXIT_SUCCESS);
send_child_error(ep[1], state, errmsg, errmsg_buflen);
#if EXIT_SUCCESS == 127
_exit(EXIT_FAILURE);