diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-06-06 13:19:29 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-06-06 13:19:29 +0200 |
commit | 1af11051bffc8d364f5e78167d9f7d8e5e3c99e9 (patch) | |
tree | def1ebab09889a8f09a9fcd074c8a672689376af /mysys | |
parent | ec97ce952e319049b183d711ea5f847352b072c3 (diff) | |
parent | 75dce25ca8276f56c45f747c9a9a1b4046b6efca (diff) | |
download | mariadb-git-1af11051bffc8d364f5e78167d9f7d8e5e3c99e9.tar.gz |
manual merge from mysql-trunk-bugfixing
Conflicts:
Text conflict in mysql-test/r/archive.result
Contents conflict in mysql-test/r/innodb_bug38231.result
Text conflict in mysql-test/r/mdl_sync.result
Text conflict in mysql-test/suite/binlog/t/disabled.def
Text conflict in mysql-test/suite/rpl_ndb/r/rpl_ndb_binlog_format_errors.result
Text conflict in mysql-test/t/archive.test
Contents conflict in mysql-test/t/innodb_bug38231.test
Text conflict in mysql-test/t/mdl_sync.test
Text conflict in sql/sp_head.cc
Text conflict in sql/sql_show.cc
Text conflict in sql/table.cc
Text conflict in sql/table.h
Diffstat (limited to 'mysys')
-rwxr-xr-x | mysys/CMakeLists.txt | 2 | ||||
-rw-r--r-- | mysys/Makefile.am | 5 | ||||
-rw-r--r-- | mysys/lf_alloc-pin.c | 3 | ||||
-rwxr-xr-x | mysys/make-ccc | 4 | ||||
-rw-r--r-- | mysys/mf_loadpath.c | 11 | ||||
-rw-r--r-- | mysys/mf_pack.c | 3 | ||||
-rw-r--r-- | mysys/my_file.c | 2 | ||||
-rw-r--r-- | mysys/my_gethwaddr.c | 56 | ||||
-rw-r--r-- | mysys/my_getwd.c | 11 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/my_mess.c (renamed from mysys/my_messnc.c) | 6 | ||||
-rw-r--r-- | mysys/my_pthread.c | 5 | ||||
-rw-r--r-- | mysys/my_static.c | 9 | ||||
-rw-r--r-- | mysys/safemalloc.c | 5 |
14 files changed, 64 insertions, 60 deletions
diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 855c5a6234b..0ea65ce8e4b 100755 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -27,7 +27,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c default_ my_clock.c my_compress.c my_copy.c my_crc32.c my_create.c my_delete.c my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c - my_lib.c my_lock.c my_lockmem.c my_malloc.c my_messnc.c + my_lib.c my_lock.c my_lockmem.c my_malloc.c my_mess.c my_mkdir.c my_mmap.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_sleep.c my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c diff --git a/mysys/Makefile.am b/mysys/Makefile.am index 476b63d3ad5..d5bffd874b2 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -34,7 +34,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \ my_vle.c my_atomic.c lf_hash.c \ lf_dynarray.c lf_alloc-pin.c \ my_fopen.c my_fstream.c my_getsystime.c \ - my_error.c errors.c my_div.c my_messnc.c \ + my_error.c errors.c my_div.c my_mess.c \ mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \ my_symlink.c my_symlink2.c \ mf_pack.c mf_unixpath.c mf_arr_appstr.c \ @@ -159,6 +159,3 @@ probes_mysql.d: probes_mysql.o: $(DTRACEPROVIDER) $(DTRACEFILES) $(DTRACE) $(DTRACEFLAGS) -G -s $(DTRACEPROVIDER) $(DTRACEFILES) -o $@ endif - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index fda9b97791d..7fd10703871 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -329,10 +329,9 @@ static void _lf_pinbox_real_free(LF_PINS *pins) { int npins, alloca_size; void *list, **addr; - void *first, *last= NULL; + void *first= NULL, *last= NULL; LF_PINBOX *pinbox= pins->pinbox; - LINT_INIT(first); npins= pinbox->pins_in_array+1; #ifdef HAVE_ALLOCA diff --git a/mysys/make-ccc b/mysys/make-ccc deleted file mode 100755 index b34bd80e1d1..00000000000 --- a/mysys/make-ccc +++ /dev/null @@ -1,4 +0,0 @@ -rm -f .deps/* raid.o mf_iocache.o libmysys.a -ccc -DDEFAULT_BASEDIR="\"/usr/local/mysql\"" -DDATADIR="\"/usr/local/mysql/var\"" -DHAVE_CONFIG_H -I./../include -I../include -I.. -DDBUG_OFF -fast -O3 -fomit-frame-pointer -c array.c checksum.c default.c errors.c getopt.c getopt1.c getvar.c hash.c list.c mf_brkhant.c mf_cache.c mf_casecnv.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_keycache.c mf_loadpath.c mf_pack.c mf_pack2.c mf_path.c mf_qsort.c mf_qsort2.c mf_radix.c mf_reccache.c mf_same.c mf_sort.c mf_soundex.c mf_stripp.c mf_unixpath.c mf_wcomp.c mf_wfile.c mulalloc.c my_alarm.c my_alloc.c my_append.c my_chsize.c my_clock.c my_compress.c my_copy.c my_create.c my_delete.c my_div.c my_error.c my_fopen.c my_fstream.c my_getwd.c my_init.c my_lib.c my_lockmem.c my_malloc.c my_messnc.c my_mkdir.c my_net.c my_once.c my_open.c my_pread.c my_pthread.c my_quick.c my_read.c my_realloc.c my_redel.c my_rename.c my_seek.c my_static.c my_tempnam.c my_thr_init.c my_write.c ptr_cmp.c queues.c safemalloc.c string.c thr_alarm.c thr_lock.c thr_mutex.c thr_rwlock.c tree.c typelib.c -make raid.o mf_iocache.o my_lock.o -ar -cr libmysys.a array.o raid.o mf_iocache.o my_lock.o diff --git a/mysys/mf_loadpath.c b/mysys/mf_loadpath.c index fbf6f7f5d57..07851ab6e92 100644 --- a/mysys/mf_loadpath.c +++ b/mysys/mf_loadpath.c @@ -34,7 +34,7 @@ char * my_load_path(char * to, const char *path, if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || test_if_hard_path(path)) - (void) strmov(buff,path); + (void) strnmov(buff, path, FN_REFLEN); else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) || (is_prefix(path,FN_PARENTDIR)) || ! own_path_prefix) @@ -42,13 +42,14 @@ char * my_load_path(char * to, const char *path, if (is_cur) is_cur=2; /* Remove current dir */ if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)+is_cur),MYF(0))) - (void) strcat(buff,path+is_cur); + (void) strncat(buff, path+is_cur, FN_REFLEN); else - (void) strmov(buff,path); /* Return org file name */ + (void) strnmov(buff, path, FN_REFLEN); /* Return org file name */ } else - (void) strxmov(buff,own_path_prefix,path,NullS); - strmov(to,buff); + (void) strxnmov(buff, FN_REFLEN, own_path_prefix, path, NullS); + strnmov(to, buff, FN_REFLEN); + to[FN_REFLEN-1]= '\0'; DBUG_PRINT("exit",("to: %s",to)); DBUG_RETURN(to); } /* my_load_path */ diff --git a/mysys/mf_pack.c b/mysys/mf_pack.c index c13a5581b80..4f7cd90e8aa 100644 --- a/mysys/mf_pack.c +++ b/mysys/mf_pack.c @@ -311,6 +311,9 @@ size_t normalize_dirname(char *to, const char *from) #endif buff[length - 1] != FN_LIBCHAR && buff[length - 1] != '/') { + /* we need reserve 2 bytes for the trailing slash and the zero */ + if (length >= sizeof (buff) - 1) + length= sizeof (buff) - 2; buff[length]= FN_LIBCHAR; buff[length + 1]= '\0'; } diff --git a/mysys/my_file.c b/mysys/my_file.c index ec0c9c425ea..a31673b31bc 100644 --- a/mysys/my_file.c +++ b/mysys/my_file.c @@ -72,7 +72,7 @@ static uint set_max_open_files(uint max_file_limit) } #else -static int set_max_open_files(uint max_file_limit) +static uint set_max_open_files(uint max_file_limit) { /* We don't know the limit. Return best guess */ return min(max_file_limit, OS_FILE_LIMIT); diff --git a/mysys/my_gethwaddr.c b/mysys/my_gethwaddr.c index 38fa0313c5d..c6a7af58f57 100644 --- a/mysys/my_gethwaddr.c +++ b/mysys/my_gethwaddr.c @@ -102,47 +102,49 @@ err: } #elif defined(__WIN__) -
-/* Workaround for BUG#32082 (Definition of VOID in my_global.h conflicts with
-windows headers) */
-#ifdef VOID
-#undef VOID
-#define VOID void
-#endif
+ +/* + Workaround for BUG#32082 (Definition of VOID in my_global.h conflicts with + windows headers) +*/ +#ifdef VOID +#undef VOID +#define VOID void +#endif #include <iphlpapi.h> -/* - The following typedef is for dynamically loading - iphlpapi.dll / GetAdaptersAddresses. Dynamic loading is - used because GetAdaptersAddresses is not available on Windows 2000 - which MySQL still supports. Static linking would cause an unresolved export. +/* + The following typedef is for dynamically loading iphlpapi.dll / + GetAdaptersAddresses. Dynamic loading is used because + GetAdaptersAddresses is not available on Windows 2000 which MySQL + still supports. Static linking would cause an unresolved export. */ typedef DWORD (WINAPI *pfnGetAdaptersAddresses)(IN ULONG Family, IN DWORD Flags,IN PVOID Reserved, - OUT PIP_ADAPTER_ADDRESSES pAdapterAddresses, + OUT PIP_ADAPTER_ADDRESSES pAdapterAddresses, IN OUT PULONG pOutBufLen); /* - my_gethwaddr - Windows version + my_gethwaddr - Windows version @brief Retrieve MAC address from network hardware - + @param[out] to MAC address exactly six bytes - + @return Operation status @retval 0 OK - @retval <>0 FAILED + @retval <>0 FAILED */ my_bool my_gethwaddr(uchar *to) -{ +{ PIP_ADAPTER_ADDRESSES pAdapterAddresses; PIP_ADAPTER_ADDRESSES pCurrAddresses; IP_ADAPTER_ADDRESSES adapterAddresses; ULONG address_len; - my_bool return_val= 1; - static pfnGetAdaptersAddresses fnGetAdaptersAddresses= - (pfnGetAdaptersAddresses)-1; + my_bool return_val= 1; + static pfnGetAdaptersAddresses fnGetAdaptersAddresses= + (pfnGetAdaptersAddresses)-1; if(fnGetAdaptersAddresses == (pfnGetAdaptersAddresses)-1) { @@ -156,7 +158,7 @@ my_bool my_gethwaddr(uchar *to) address_len= sizeof (IP_ADAPTER_ADDRESSES); /* Get the required size for the address data. */ - if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, &adapterAddresses, &address_len) + if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, &adapterAddresses, &address_len) == ERROR_BUFFER_OVERFLOW) { pAdapterAddresses= my_malloc(address_len, 0); @@ -167,29 +169,29 @@ my_bool my_gethwaddr(uchar *to) pAdapterAddresses= &adapterAddresses; /* one is enough don't alloc */ /* Get the hardware info. */ - if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, pAdapterAddresses, &address_len) + if (fnGetAdaptersAddresses(AF_UNSPEC, 0, 0, pAdapterAddresses, &address_len) == NO_ERROR) { pCurrAddresses= pAdapterAddresses; - while (pCurrAddresses) + while (pCurrAddresses) { /* Look for ethernet cards. */ if (pCurrAddresses->IfType == IF_TYPE_ETHERNET_CSMACD) { /* check for a good address */ if (pCurrAddresses->PhysicalAddressLength < 6) - continue; /* bad address */ + continue; /* bad address */ /* save 6 bytes of the address in the 'to' parameter */ memcpy(to, pCurrAddresses->PhysicalAddress, 6); /* Network card found, we're done. */ return_val= 0; - break; + break; } pCurrAddresses= pCurrAddresses->Next; - } + } } /* Clean up memory allocation. */ diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index 6ef8d571492..4182ea9826f 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -50,16 +50,21 @@ int my_getwd(char * buf, size_t size, myf MyFlags) DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %d", (long) buf, (uint) size, MyFlags)); + if (size < 1) + DBUG_RETURN(-1); + if (curr_dir[0]) /* Current pos is saved here */ (void) strmake(buf,&curr_dir[0],size-1); else { #if defined(HAVE_GETCWD) + if (size < 2) + DBUG_RETURN(-1); if (!getcwd(buf,(uint) (size-2)) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - return(-1); + DBUG_RETURN(-1); } #elif defined(HAVE_GETWD) { @@ -68,11 +73,13 @@ int my_getwd(char * buf, size_t size, myf MyFlags) strmake(buf,pathname,size-1); } #elif defined(VMS) + if (size < 2) + DBUG_RETURN(-1); if (!getcwd(buf,size-2,1) && MyFlags & MY_WME) { my_errno=errno; my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno); - return(-1); + DBUG_RETURN(-1); } intern_filename(buf,buf); #else diff --git a/mysys/my_init.c b/mysys/my_init.c index 80f9a493bb0..f27f3f7b3e8 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -204,7 +204,7 @@ void my_end(int infoflag) 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); + my_message_stderr(EE_OPEN_WARNING, ebuff, ME_BELL); DBUG_PRINT("error", ("%s", ebuff)); my_print_open_files(); } diff --git a/mysys/my_messnc.c b/mysys/my_mess.c index e2dee3f6710..0ec97525ae8 100644 --- a/mysys/my_messnc.c +++ b/mysys/my_mess.c @@ -15,10 +15,10 @@ #include "mysys_priv.h" -void my_message_no_curses(uint error __attribute__((unused)), - const char *str, myf MyFlags) +void my_message_stderr(uint error __attribute__((unused)), + const char *str, myf MyFlags) { - DBUG_ENTER("my_message_no_curses"); + DBUG_ENTER("my_message_stderr"); DBUG_PRINT("enter",("message: %s",str)); (void) fflush(stdout); if (MyFlags & ME_BELL) diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index b6b7e7db857..3019e4bc5c1 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -492,11 +492,6 @@ int my_pthread_mutex_trylock(pthread_mutex_t *mutex) /* Some help functions */ -int pthread_no_free(void *not_used __attribute__((unused))) -{ - return 0; -} - int pthread_dummy(int ret) { return ret; diff --git a/mysys/my_static.c b/mysys/my_static.c index a86fe6c7ab7..ff5abba29d3 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -87,10 +87,10 @@ ulong my_time_to_wait_for_lock=2; /* In seconds */ char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */ #endif void (*my_abort_hook)(int) = (void(*)(int)) exit; -void (*error_handler_hook)(uint error,const char *str,myf MyFlags)= - my_message_no_curses; -void (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)= - my_message_no_curses; +void (*error_handler_hook)(uint error, const char *str, myf MyFlags)= + my_message_stderr; +void (*fatal_error_handler_hook)(uint error, const char *str, myf MyFlags)= + my_message_stderr; static const char *proc_info_dummy(void *a __attribute__((unused)), const char *b __attribute__((unused)), @@ -123,7 +123,6 @@ my_bool NEAR my_disable_locking=0; my_bool NEAR my_disable_async_io=0; my_bool NEAR my_disable_flush_key_blocks=0; my_bool NEAR my_disable_symlinks=0; -my_bool NEAR mysys_uses_curses=0; /* Note that PSI_hook and PSI_server are unconditionally diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c index efe281ba1bb..936248677f5 100644 --- a/mysys/safemalloc.c +++ b/mysys/safemalloc.c @@ -190,9 +190,12 @@ void *_mymalloc(size_t size, const char *filename, uint lineno, myf MyFlags) sf_malloc_count++; mysql_mutex_unlock(&THR_LOCK_malloc); + MEM_CHECK_ADDRESSABLE(data, size); /* Set the memory to the aribtrary wierd value */ if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick) bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL)); + if (!(MyFlags & MY_ZEROFILL)) + MEM_UNDEFINED(data, size); /* Return a pointer to the real data */ DBUG_PRINT("exit",("ptr: %p", data)); if (sf_min_adress > data) @@ -309,7 +312,9 @@ void _myfree(void *ptr, const char *filename, uint lineno, myf myflags) if (!sf_malloc_quick) bfill(ptr, irem->datasize, (pchar) FREE_VAL); #endif + MEM_NOACCESS(ptr, irem->datasize); *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY; + MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32)); /* Actually free the memory */ free((char*) irem); DBUG_VOID_RETURN; |