summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-02-18 10:10:34 +0100
committerSergei Golubchik <serg@mariadb.org>2017-02-27 12:35:10 +0100
commitc826ac9d539fa66d45afd0ca0d54b2579fcbb797 (patch)
treee84f7e2fd5ac57ca525f07e5c19155667a3fe648
parent24d8bc707a3d3161229b1cfc94b34dc50473bc59 (diff)
downloadmariadb-git-c826ac9d539fa66d45afd0ca0d54b2579fcbb797.tar.gz
cleanup: mysys_test_invalid_symlink
Remove maria_test_invalid_symlink() and myisam_test_invalid_symlink(), introduce mysys_test_invalid_symlink(). Other engines might need it too
-rw-r--r--include/my_sys.h2
-rw-r--r--mysys/my_symlink.c9
-rw-r--r--sql/mysqld.cc2
-rw-r--r--storage/maria/ha_maria.cc4
-rw-r--r--storage/maria/ma_open.c4
-rw-r--r--storage/maria/ma_static.c6
-rw-r--r--storage/myisam/mi_delete_table.c4
-rw-r--r--storage/myisam/mi_open.c4
-rw-r--r--storage/myisam/mi_static.c8
9 files changed, 18 insertions, 25 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 967228790ae..82ab830e9c7 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -548,6 +548,8 @@ extern ulong my_crc_dbug_check;
typedef int (*Process_option_func)(void *ctx, const char *group_name,
const char *option);
+extern int (*mysys_test_invalid_symlink)(const char *filename);
+
#include <my_alloc.h>
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index b0e910f7ba0..bc01a68263d 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -1,5 +1,6 @@
/*
Copyright (c) 2001, 2011, Oracle and/or its affiliates
+ Copyright (c) 2010, 2017, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,6 +24,14 @@
#include <sys/stat.h>
#endif
+static int always_valid(const char *filename __attribute__((unused)))
+{
+ return 0;
+}
+
+int (*mysys_test_invalid_symlink)(const char *filename)= always_valid;
+
+
/*
Reads the content of a symbolic link
If the file is not a symbolic link, return the original file name in to.
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index eb19e09d74e..2e8a62ecb12 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7267,7 +7267,7 @@ static int mysql_init_variables(void)
mysql_home[0]= pidfile_name[0]= log_error_file[0]= 0;
#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
/* We can only test for sub paths if my_symlink.c is using realpath */
- myisam_test_invalid_symlink= test_if_data_home_dir;
+ mysys_test_invalid_symlink= test_if_data_home_dir;
#endif
opt_log= opt_slow_log= 0;
opt_bin_log= opt_bin_log_used= 0;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 38ee0758611..60e3f62096d 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -3572,10 +3572,6 @@ static int ha_maria_init(void *p)
maria_pagecache->extra_debug= 1;
maria_assert_if_crashed_table= debug_assert_if_crashed_table;
-#if defined(HAVE_REALPATH) && !defined(HAVE_valgrind) && !defined(HAVE_BROKEN_REALPATH)
- /* We can only test for sub paths if my_symlink.c is using realpath */
- maria_test_invalid_symlink= test_if_data_home_dir;
-#endif
if (res)
maria_hton= 0;
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index f8f90812e51..83d37a17483 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -288,7 +288,7 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags)
MARIA_NAME_IEXT,
MY_UNPACK_FILENAME),MYF(0));
if (my_is_symlink(org_name) &&
- (realpath_err || (*maria_test_invalid_symlink)(name_buff)))
+ (realpath_err || mysys_test_invalid_symlink(name_buff)))
{
my_errno= HA_WRONG_CREATE_OPTION;
DBUG_RETURN(0);
@@ -1880,7 +1880,7 @@ int _ma_open_datafile(MARIA_HA *info, MARIA_SHARE *share, const char *org_name,
if (my_is_symlink(real_data_name))
{
if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
- (*maria_test_invalid_symlink)(real_data_name))
+ mysys_test_invalid_symlink(real_data_name))
{
my_errno= HA_WRONG_CREATE_OPTION;
return 1;
diff --git a/storage/maria/ma_static.c b/storage/maria/ma_static.c
index a075459d389..3b6115e8a37 100644
--- a/storage/maria/ma_static.c
+++ b/storage/maria/ma_static.c
@@ -106,12 +106,6 @@ uint32 maria_readnext_vec[]=
SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
};
-static int always_valid(const char *filename __attribute__((unused)))
-{
- return 0;
-}
-
-int (*maria_test_invalid_symlink)(const char *filename)= always_valid;
my_bool (*ma_killed)(MARIA_HA *)= ma_killed_standalone;
#ifdef HAVE_PSI_INTERFACE
diff --git a/storage/myisam/mi_delete_table.c b/storage/myisam/mi_delete_table.c
index 885990ee1be..7643c093e86 100644
--- a/storage/myisam/mi_delete_table.c
+++ b/storage/myisam/mi_delete_table.c
@@ -30,7 +30,7 @@ int mi_delete_table(const char *name)
#endif
fn_format(from,name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from))
+ if (my_is_symlink(from) && mysys_test_invalid_symlink(from))
{
/*
Symlink is pointing to file in data directory.
@@ -45,7 +45,7 @@ int mi_delete_table(const char *name)
DBUG_RETURN(my_errno);
}
fn_format(from,name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from))
+ if (my_is_symlink(from) && mysys_test_invalid_symlink(from))
{
/*
Symlink is pointing to file in data directory.
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 94bc92088ad..7efed26a52b 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -93,7 +93,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
realpath_err= my_realpath(name_buff,
fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
if (my_is_symlink(org_name) &&
- (realpath_err || (*myisam_test_invalid_symlink)(name_buff)))
+ (realpath_err || mysys_test_invalid_symlink(name_buff)))
{
my_errno= HA_WRONG_CREATE_OPTION;
DBUG_RETURN (NULL);
@@ -1246,7 +1246,7 @@ int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, const char *org_name,
if (my_is_symlink(real_data_name))
{
if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
- (*myisam_test_invalid_symlink)(real_data_name))
+ mysys_test_invalid_symlink(real_data_name))
{
my_errno= HA_WRONG_CREATE_OPTION;
return 1;
diff --git a/storage/myisam/mi_static.c b/storage/myisam/mi_static.c
index 30e463746d5..a8bff936ad1 100644
--- a/storage/myisam/mi_static.c
+++ b/storage/myisam/mi_static.c
@@ -42,14 +42,6 @@ ulong myisam_data_pointer_size=4;
ulonglong myisam_mmap_size= SIZE_T_MAX, myisam_mmap_used= 0;
my_bool (*mi_killed)(MI_INFO *)= mi_killed_standalone;
-static int always_valid(const char *filename __attribute__((unused)))
-{
- return 0;
-}
-
-int (*myisam_test_invalid_symlink)(const char *filename)= always_valid;
-
-
/*
read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
Position is , == , >= , <= , > , <