diff --git a/ChangeLog b/ChangeLog index e906c6310f..715bb07e4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 23 22:57:48 2008 Tanaka Akira + + * process.c (rb_fork): don't propagete an error message if error + buffer not given. + Tue Dec 23 21:55:05 2008 Tanaka Akira * process.c (rb_fork): propagete an error message from child to parent. diff --git a/process.c b/process.c index 51683de2fa..cfc2e8d5f0 100644 --- a/process.c +++ b/process.c @@ -2477,8 +2477,10 @@ rb_fork(int *status, int (*chfunc)(void*, char *, size_t), void *charg, VALUE fd #ifdef FD_CLOEXEC err = errno; write(ep[1], &err, sizeof(err)); - errmsg[errmsg_buflen-1] = '\0'; - write(ep[1], errmsg, strlen(errmsg)); + if (errmsg && 0 < errmsg_buflen) { + errmsg[errmsg_buflen-1] = '\0'; + write(ep[1], errmsg, strlen(errmsg)); + } #endif #if EXIT_SUCCESS == 127 _exit(EXIT_FAILURE);