Skip to content

Commit

Permalink
* error.c (report_bug): use a small message buffer instead of BUFSIZ.
Browse files Browse the repository at this point in the history
  It is needed for avoiding nested SIGSEGV on Linux.
  Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
  filename length. :-/
  [Bug ruby#5139] [ruby-dev:44315]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
kosaki committed Aug 4, 2011
1 parent 1c647cc commit 3abbda4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 3 additions & 2 deletions error.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3abbda4

Please sign in to comment.