From 3ad7e5e2a2f1ba31ee9e6fe34b342143225f7c10 Mon Sep 17 00:00:00 2001 From: Satoshi MITANI Date: Sat, 27 Oct 2012 23:37:26 +0900 Subject: [PATCH] Fixed some compile errors --- include/audit_handler.h | 4 ++-- src/audit_handler.cc | 2 +- src/audit_plugin.cc | 12 ++++++------ src/hot_patch.cc | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/audit_handler.h b/include/audit_handler.h index 14cddfb..bd248ea 100755 --- a/include/audit_handler.h +++ b/include/audit_handler.h @@ -158,8 +158,8 @@ public: return NULL; #else - *len = thd->query_length; - return thd->query; + *len = thd->query_length(); + return thd->query(); #endif } diff --git a/src/audit_handler.cc b/src/audit_handler.cc index 20051d7..070dc69 100644 --- a/src/audit_handler.cc +++ b/src/audit_handler.cc @@ -200,7 +200,7 @@ void Audit_file_handler::handler_start() { sql_print_error( "%s unable to write to %s: %s. Disabling audit handler.", - AUDIT_LOG_PREFIX, m_log_file, strerror(errno)); + AUDIT_LOG_PREFIX, m_filename, strerror(errno)); close_file(); m_enabled = false; } diff --git a/src/audit_plugin.cc b/src/audit_plugin.cc index b107248..21095a6 100755 --- a/src/audit_plugin.cc +++ b/src/audit_plugin.cc @@ -1371,7 +1371,7 @@ static void setup_record_objs_array() { record_empty_objs_set = true; } - sql_print_information("%s Set num_record_objs: %d record objs: %s", log_prefix, num_record_objs, record_objs_array); + sql_print_information("%s Set num_record_objs: %d record objs: %s", log_prefix, num_record_objs, *record_objs_array); } __attribute__ ((noinline)) static void trampoline_dummy_func_for_mem() @@ -1400,12 +1400,12 @@ static int do_hot_patch(void ** trampoline_func_pp, unsigned int * trampoline_si { //hot patch failed. sql_print_error("%s unable to hot patch %s (0x%lx). res: %d. Aborting.", - log_prefix, func_name, res); + log_prefix, func_name, (unsigned long)target_function, res); return 1; } sql_print_information( "%s hot patch for: %s (0x%lx) complete. Audit func: 0x%lx, Trampoline address: 0x%lx size: %u.", - log_prefix, func_name, target_function, audit_function, *trampoline_func_pp, *trampoline_size); + log_prefix, func_name, (unsigned long)target_function, (unsigned long)audit_function, (unsigned long)*trampoline_func_pp, *trampoline_size); trampoline_mem_free = (void *)(((DATATYPE_ADDRESS)*trampoline_func_pp) + *trampoline_size + jump_size()); return 0; } @@ -1488,21 +1488,21 @@ static int do_hot_patch(void ** trampoline_func_pp, unsigned int * trampoline_si trampoline_mem = (void*)(addrs & ~(page_size - 1)); sql_print_information( "%s mem func addr: 0x%lx mem start addr: 0x%lx page size: %ld", - log_prefix, trampoline_dummy_func_for_mem, trampoline_mem, page_size); + log_prefix, (unsigned long)trampoline_dummy_func_for_mem, (unsigned long)trampoline_mem, page_size); } else //big pages for some reason. allocate mem using mmap { trampoline_mem = mmap(NULL, page_size, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); if(MAP_FAILED == trampoline_mem) { - sql_print_error("%s unable to mmap memory size: %d, errno: %d. Aborting.", + sql_print_error("%s unable to mmap memory size: %lu, errno: %d. Aborting.", log_prefix, page_size, errno); DBUG_RETURN(1); } else { sql_print_information( - "%s mem via mmap: 0x%lx page size: %ld", log_prefix, trampoline_mem, page_size); + "%s mem via mmap: 0x%lx page size: %ld", log_prefix, (unsigned long)trampoline_mem, page_size); } } trampoline_mem_free = trampoline_mem; diff --git a/src/hot_patch.cc b/src/hot_patch.cc index 2e264f0..c37e17d 100755 --- a/src/hot_patch.cc +++ b/src/hot_patch.cc @@ -30,7 +30,7 @@ static int unprotect(void *addr, size_t len) { sql_print_information( "%s unable to unprotect. Page: 0x%lx, Size: %d, errno: %d. Using NO EXEC mode.", - log_prefix, addr, len, errno); + log_prefix, (unsigned long)addr, len, errno); use_exec_prot = false; } else //all is good @@ -43,7 +43,7 @@ static int unprotect(void *addr, size_t len) { sql_print_error( "%s unable to unprotect. Page: 0x%lx, Size: %d, errno: %d. Error.", - log_prefix, addr, len, errno); + log_prefix, (unsigned long)addr, len, errno); } return res; } @@ -201,7 +201,7 @@ static void UnhookFunction(ULONG_PTR Function,ULONG_PTR trampolineFunction , uns int hot_patch_function (void* targetFunction, void* newFunction, void * trampolineFunction, unsigned int *trampolinesize, bool info_print) { DATATYPE_ADDRESS trampolinePage = get_page_address(trampolineFunction); - cond_info_print(info_print, "%s hot patching function: 0x%lx, trampolineFunction: 0x%lx trampolinePage: 0x%lx",log_prefix, targetFunction, trampolineFunction, trampolinePage); + cond_info_print(info_print, "%s hot patching function: 0x%lx, trampolineFunction: 0x%lx trampolinePage: 0x%lx",log_prefix, (unsigned long)targetFunction, (unsigned long)trampolineFunction, (unsigned long)trampolinePage); if (HookFunction((ULONG_PTR) targetFunction, (ULONG_PTR) newFunction, (ULONG_PTR) trampolineFunction, trampolinesize)) { @@ -230,7 +230,7 @@ void remove_hot_patch_function (void* targetFunction, void * trampolineFunction, return; } DATATYPE_ADDRESS targetPage = get_page_address(targetFunction); - cond_info_print(info_print, "%s removing hot patching function: 0x%lx targetPage: 0x%lx trampolineFunction: 0x%lx",log_prefix, targetFunction, targetPage, trampolineFunction); + cond_info_print(info_print, "%s removing hot patching function: 0x%lx targetPage: 0x%lx trampolineFunction: 0x%lx",log_prefix, (unsigned long)targetFunction, (unsigned long)targetPage, (unsigned long)trampolineFunction); UnhookFunction ((ULONG_PTR) targetFunction, (ULONG_PTR)trampolineFunction,trampolinesize); return; }