From b317b345e89b1d8f3daa207973fc34d9b3f13e32 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 23 Dec 2008 13:59:10 +0000 Subject: [PATCH] * process.c (rb_fork): don't propagete an error message if error buffer not given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ process.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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);