diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-15 14:03:02 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-15 14:03:02 +0900 |
| commit | 195d1dd685124edf93735a751f8ec34a7bfe76c0 (patch) | |
| tree | 8b997c60dbd68a4a8dfd90804440652f936417e8 /src | |
| parent | 39f47c191557ca401b6aaceb04b395227431b62f (diff) | |
| download | mruby-195d1dd685124edf93735a751f8ec34a7bfe76c0.tar.gz mruby-195d1dd685124edf93735a751f8ec34a7bfe76c0.zip | |
do not use fixed sized buffer in mrb_bug/mrb_warn; close #287
Diffstat (limited to 'src')
| -rw-r--r-- | src/error.c | 12 |
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 * |
