summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-04 11:23:16 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-08-04 11:23:16 +0000
commit3abbda4f6ef4e2c314bb288b2a2b5cc0762ee652 (patch)
tree733c239be06f8bfe05586132daf8ef9aa9241d68
parent1c647cc203485dad91b8e34b0ea07354c8c3578f (diff)
* error.c (report_bug): use a small message buffer instead of BUFSIZ.
It is needed for avoiding nested SIGSEGV on Linux. Note: BUFSIZ is not proper buffer size. It's unrelated with maximum filename length. :-/ [Bug #5139] [ruby-dev:44315] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--error.c5
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a5b079d28..4906f11af3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Aug 4 20:19:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * error.c (report_bug): use a small message buffer instead of BUFSIZ.
+ It is needed for avoiding nested SIGSEGV on Linux.
+ Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
+ filename length. :-/
+ [Bug #5139] [ruby-dev:44315]
+
Thu Aug 4 16:08:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
* tool/rbinstall.rb (gem): install all gemspecs under lib and ext.
diff --git a/error.c b/error.c
index 834eede8af..646fb16232 100644
--- a/error.c
+++ b/error.c
@@ -251,9 +251,10 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc)
static void
report_bug(const char *file, int line, const char *fmt, va_list args)
{
- char buf[BUFSIZ];
+ /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
+ char buf[256];
FILE *out = stderr;
- int len = err_position_0(buf, BUFSIZ, file, line);
+ int len = err_position_0(buf, 256, file, line);
if ((ssize_t)fwrite(buf, 1, len, out) == (ssize_t)len ||
(ssize_t)fwrite(buf, 1, len, (out = stdout)) == (ssize_t)len) {