summaryrefslogtreecommitdiffhomepage
path: root/src/error.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-06-15 14:03:02 +0900
committerYukihiro Matsumoto <[email protected]>2012-06-15 14:03:02 +0900
commit195d1dd685124edf93735a751f8ec34a7bfe76c0 (patch)
tree8b997c60dbd68a4a8dfd90804440652f936417e8 /src/error.c
parent39f47c191557ca401b6aaceb04b395227431b62f (diff)
downloadmruby-195d1dd685124edf93735a751f8ec34a7bfe76c0.tar.gz
mruby-195d1dd685124edf93735a751f8ec34a7bfe76c0.zip
do not use fixed sized buffer in mrb_bug/mrb_warn; close #287
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/error.c b/src/error.c
index 590fad5a5..3ef08a631 100644
--- a/src/error.c
+++ b/src/error.c
@@ -229,25 +229,23 @@ void
mrb_warn(const char *fmt, ...)
{
va_list args;
- char buf[256];
va_start(args, fmt);
- snprintf(buf, 256, "warning: %s", fmt);
- printf(buf, args);
+ printf("warning: ");
+ vprintf(fmt, args);
va_end(args);
}
-
void
mrb_bug(const char *fmt, ...)
{
va_list args;
- char buf[256];
va_start(args, fmt);
- snprintf(buf, 256, "bug: %s", fmt);
- printf(buf, args);
+ printf("bug: ");
+ vprintf(fmt, args);
va_end(args);
+ exit(EXIT_FAILURE);
}
static const char *