mirror of
https://github.com/MariaDB/server.git
synced 2026-04-25 09:45:31 +02:00
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
This commit is contained in:
parent
24d8bc707a
commit
c826ac9d53
9 changed files with 18 additions and 25 deletions
|
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 , == , >= , <= , > , <
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue