diff options
author | msvensson@pilot.(none) <> | 2007-05-29 12:53:03 +0200 |
---|---|---|
committer | msvensson@pilot.(none) <> | 2007-05-29 12:53:03 +0200 |
commit | 5ceeb9329188e1fc882f20ef6606c8686f7e11dd (patch) | |
tree | 800ab85c8cf284f203cd8b537a7b7c74e733ad27 /mysys/my_init.c | |
parent | dec5334a2be05cf1a9c3edeaba0d9bf7f0baccc9 (diff) | |
parent | 47536706a092cbf71ec0bfb73f56d76a401d4a7b (diff) | |
download | mariadb-git-5ceeb9329188e1fc882f20ef6606c8686f7e11dd.tar.gz |
Merge pilot.(none):/data/msvensson/mysql/bug27597/my50-bug27597
into pilot.(none):/data/msvensson/mysql/bug27597/my51-bug27597
Diffstat (limited to 'mysys/my_init.c')
-rw-r--r-- | mysys/my_init.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysys/my_init.c b/mysys/my_init.c index 7784c09d9d6..c0e4a8ef3e9 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -267,6 +267,34 @@ void my_parameter_handler(const wchar_t * expression, const wchar_t * function, } +#ifdef __MSVC_RUNTIME_CHECKS +#include <rtcapi.h> + +/* Turn off runtime checks for 'handle_rtc_failure' */ +#pragma runtime_checks("", off) + +/* + handle_rtc_failure + Catch the RTC error and dump it to stderr +*/ + +int handle_rtc_failure(int err_type, const char *file, int line, + const char* module, const char *format, ...) +{ + va_list args; + va_start(args, format); + fprintf(stderr, "Error:"); + vfprintf(stderr, format, args); + fprintf(stderr, " At %s:%d\n", file, line); + va_end(args); + (void) fflush(stderr); + + return 0; /* Error is handled */ +} +#pragma runtime_checks("", on) +#endif + + static void my_win_init(void) { HKEY hSoftMysql ; @@ -297,6 +325,14 @@ static void my_win_init(void) _set_invalid_parameter_handler(my_parameter_handler); #endif #endif +#ifdef __MSVC_RUNTIME_CHECKS + /* + Install handler to send RTC (Runtime Error Check) warnings + to log file + */ + _RTC_SetErrorFunc(handle_rtc_failure); +#endif + _tzset(); /* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */ |