From 036b689f187361848a315a192a83556256c0fe96 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 18 Apr 2017 11:29:02 +0200 Subject: MDEV-12310 openat(, ...O_EXEC) fails on Illumos / Solaris it could be * O_SEARCH on Illumos * O_EXEC on FreeBSD * O_PATH on Linux ugh --- mysys/mysys_priv.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/mysys_priv.h b/mysys/mysys_priv.h index 4b489504c26..661c4c184f1 100644 --- a/mysys/mysys_priv.h +++ b/mysys/mysys_priv.h @@ -89,9 +89,13 @@ void sf_free(void *ptr); void my_error_unregister_all(void); -#if !defined(O_PATH) && defined(O_EXEC) /* FreeBSD */ +#ifndef O_PATH /* not Linux */ +#if defined(O_SEARCH) /* Illumos */ +#define O_PATH O_SEARCH +#elif defined(O_EXEC) /* FreeBSD */ #define O_PATH O_EXEC #endif +#endif #ifdef O_PATH #define HAVE_OPEN_PARENT_DIR_NOSYMLINKS -- cgit v1.2.1 From 4fe65ca33a6012ec60c665f6eeb5ff08969fb267 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 18 Apr 2017 12:35:05 +0200 Subject: =?UTF-8?q?MDEV-12230=20include/my=5Fsys.h:600:43:=20error:=20unkn?= =?UTF-8?q?own=20type=20name=20=E2=80=98PSI=5Ffile=5Fkey=E2=80=99"=20when?= =?UTF-8?q?=20-DWITHOUT=5FSERVER=3D1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cherry-pick 2c2bd8c155 (MDEV-12261 build failure without P_S) from 10.0 --- mysys/my_symlink2.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'mysys') diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index 5fe7b8fcae9..c851468ce1b 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -170,22 +170,20 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) in this case both the symlink and the symlinked file are deleted, but only if the symlinked file is not in the datadir. */ -int my_handler_delete_with_symlink(PSI_file_key key, const char *name, - const char *ext, myf sync_dir) +int my_handler_delete_with_symlink(const char *filename, myf sync_dir) { - char orig[FN_REFLEN], real[FN_REFLEN]; + char real[FN_REFLEN]; int res= 0; DBUG_ENTER("my_handler_delete_with_symlink"); - fn_format(orig, name, "", ext, MY_UNPACK_FILENAME | MY_APPEND_EXT); - if (my_is_symlink(orig)) + if (my_is_symlink(filename)) { /* Delete the symlinked file only if the symlink is not pointing into datadir. */ - if (!(my_realpath(real, orig, MYF(0)) || mysys_test_invalid_symlink(real))) - res= mysql_file_delete(key, real, MYF(MY_NOSYMLINKS | MY_WME | sync_dir)); + if (!(my_realpath(real, filename, MYF(0)) || mysys_test_invalid_symlink(real))) + res= my_delete(real, MYF(MY_NOSYMLINKS | sync_dir)); } - DBUG_RETURN(mysql_file_delete(key, orig, MYF(MY_WME | sync_dir)) || res); + DBUG_RETURN(my_delete(filename, MYF(sync_dir)) || res); } -- cgit v1.2.1 From 602b5e4c498ad2e2d045adfa4fd1478ac437582a Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 18 Apr 2017 17:20:34 +1000 Subject: WIP: global readonly variable pcre_frame_size --- mysys/my_init.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mysys') diff --git a/mysys/my_init.c b/mysys/my_init.c index dee41e1202a..206f96827c3 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -45,6 +45,8 @@ my_bool my_init_done= 0; uint mysys_usage_id= 0; /* Incremented for each my_init() */ ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024); +/* http://pcre.org/original/doc/html/pcrestack.html - replaced by init_pcre value */ +ulonglong my_pcre_frame_size= 640 + 16; static ulong atoi_octal(const char *str) { -- cgit v1.2.1 From 52aa200919b1fd9357c05bcdfc66a42e51f242b3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 11 May 2017 19:48:42 +0200 Subject: MDEV-12420 max_recursive_iterations did not prevent a stack-overflow and segfault post-review fixes * move pcre-specific variable out of mysys * don't use current_thd * move a commonly used macro to my_sys.h * remove new sysvar --- mysys/lf_alloc-pin.c | 6 ------ mysys/my_init.c | 2 -- 2 files changed, 8 deletions(-) (limited to 'mysys') diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 282433ea48d..a60a2ae657c 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -328,12 +328,6 @@ static int match_pins(LF_PINS *el, void *addr) return 0; } -#if STACK_DIRECTION < 0 -#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END)) -#else -#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR)) -#endif - #define next_node(P, X) (*((uchar * volatile *)(((uchar *)(X)) + (P)->free_ptr_offset))) #define anext_node(X) next_node(&allocator->pinbox, (X)) diff --git a/mysys/my_init.c b/mysys/my_init.c index 206f96827c3..dee41e1202a 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -45,8 +45,6 @@ my_bool my_init_done= 0; uint mysys_usage_id= 0; /* Incremented for each my_init() */ ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024); -/* http://pcre.org/original/doc/html/pcrestack.html - replaced by init_pcre value */ -ulonglong my_pcre_frame_size= 640 + 16; static ulong atoi_octal(const char *str) { -- cgit v1.2.1 From 648d86615043e76633ac536b1000ba86abbc8af1 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 18 May 2017 12:24:44 +0200 Subject: Fixed typo in the case operator. --- mysys/ma_dyncol.c | 1 + 1 file changed, 1 insertion(+) (limited to 'mysys') diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 7cd0c2b02df..85c0b947497 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -4039,6 +4039,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) *dbl= strtod(str, &end); if (*end != '\0') rc= ER_DYNCOL_TRUNCATED; + break; } case DYN_COL_DECIMAL: if (decimal2double(&val->x.decimal.value, dbl) != E_DEC_OK) -- cgit v1.2.1 From 7c03edf2fe66855a8ce8f2575c3aaf66af975377 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 17 May 2017 15:16:24 +0200 Subject: MDEV-6262 analyze the coverity report on mariadb uploaded 10.0, analyzed everything with the Impact=High (and a couple of Medium) --- mysys/lf_hash.c | 3 +++ mysys/ma_dyncol.c | 1 + mysys/waiting_threads.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/lf_hash.c b/mysys/lf_hash.c index 0699f5d49fe..7edf5e3a03d 100644 --- a/mysys/lf_hash.c +++ b/mysys/lf_hash.c @@ -485,7 +485,10 @@ static int initialize_bucket(LF_HASH *hash, LF_SLIST * volatile *node, return -1; if (*el == NULL && bucket && unlikely(initialize_bucket(hash, el, parent, pins))) + { + my_free(dummy); return -1; + } dummy->hashnr= my_reverse_bits(bucket) | 0; /* dummy node */ dummy->key= dummy_key; dummy->keylen= 0; diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 85c0b947497..d0d6254d11c 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -4039,6 +4039,7 @@ mariadb_dyncol_val_double(double *dbl, DYNAMIC_COLUMN_VALUE *val) *dbl= strtod(str, &end); if (*end != '\0') rc= ER_DYNCOL_TRUNCATED; + free(str); break; } case DYN_COL_DECIMAL: diff --git a/mysys/waiting_threads.c b/mysys/waiting_threads.c index 1fe6a0f9a1c..f2b1bbb5993 100644 --- a/mysys/waiting_threads.c +++ b/mysys/waiting_threads.c @@ -561,7 +561,7 @@ my_bool wt_resource_id_memcmp(const void *a, const void *b) { /* we use the fact that there's no padding in the middle of WT_RESOURCE_ID */ compile_time_assert(offsetof(WT_RESOURCE_ID, type) == sizeof(ulonglong)); - return memcmp(a, b, sizeof_WT_RESOURCE_ID); + return MY_TEST(memcmp(a, b, sizeof_WT_RESOURCE_ID)); } /** -- cgit v1.2.1