diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_error.c | 10 | ||||
-rw-r--r-- | mysys/my_init.c | 8 | ||||
-rw-r--r-- | mysys/safemalloc.c | 2 |
3 files changed, 12 insertions, 8 deletions
diff --git a/mysys/my_error.c b/mysys/my_error.c index 75701536dd3..07656dda979 100644 --- a/mysys/my_error.c +++ b/mysys/my_error.c @@ -19,6 +19,10 @@ #include <stdarg.h> #include <m_ctype.h> +/* Max length of a error message. Should be kept in sync with MYSQL_ERRMSG_SIZE. */ +#define ERRMSGSIZE (512) + + /* Define some external variables for error handling */ /* @@ -30,8 +34,6 @@ my_printf_error(ER_CODE, format, MYF(N), ...) */ -char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE]; - /* Message texts are registered into a linked list of 'my_err_head' structs. Each struct contains (1.) an array of pointers to C character strings with @@ -75,7 +77,7 @@ int my_error(int nr, myf MyFlags, ...) const char *format; struct my_err_head *meh_p; va_list args; - char ebuff[ERRMSGSIZE + 20]; + char ebuff[ERRMSGSIZE]; DBUG_ENTER("my_error"); DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno)); @@ -112,7 +114,7 @@ int my_error(int nr, myf MyFlags, ...) int my_printf_error(uint error, const char *format, myf MyFlags, ...) { va_list args; - char ebuff[ERRMSGSIZE+20]; + char ebuff[ERRMSGSIZE]; DBUG_ENTER("my_printf_error"); DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d Format: %s", error, MyFlags, errno, format)); diff --git a/mysys/my_init.c b/mysys/my_init.c index edc37a3c96f..b330ffac65a 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -153,9 +153,11 @@ void my_end(int infoflag) { /* Test if some file is left open */ if (my_file_opened | my_stream_opened) { - sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened); - (void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL); - DBUG_PRINT("error",("%s",errbuff[0])); + char ebuff[512]; + my_snprintf(ebuff, sizeof(ebuff), EE(EE_OPEN_WARNING), + my_file_opened, my_stream_opened); + my_message_no_curses(EE_OPEN_WARNING, ebuff, ME_BELL); + DBUG_PRINT("error", ("%s", ebuff)); my_print_open_files(); } } diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index 905733524e3..c484f1d4c54 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -147,7 +147,7 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) error_handler_hook=fatal_error_handler_hook; if (MyFlags & (MY_FAE+MY_WME)) { - char buff[SC_MAXWIDTH]; + char buff[256]; my_errno=errno; sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename); my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH)); |