mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
d13c54351d
Don't use static link by default (in compile-pentium) as some new systems doesn't have all static libraries available Change type for functions in plugin.h:str_mysql_ftparser_param() to const unsigned char and string lengths to size_t. One effect of the above change is that one needs to include mysql_global.h or define size_t before including plugin.h This fixes a case where mysql_client_test failed with newer gcc that enables strict-aliasing by default BUILD/compile-pentium: Don't use static link by default as some new systems doesn't have all static libraries available client/mysql_upgrade.c: Remove not used variable cmd-line-utils/readline/config_readline.h: Define some constants to get rid of compiler warnings on Linux cmd-line-utils/readline/display.c: Get rid of compiler warnings cmd-line-utils/readline/history.c: Got rid of compiler warnings: - Defining some strings as const - Added cast cmd-line-utils/readline/rlmbutil.h: Added cast to get rid of compiler warnings cmd-line-utils/readline/text.c: Remove not needed initialization to get rid of compiler warnings cmd-line-utils/readline/xmalloc.c: Changed types to 'const char* to get rid of compiler warnings configure.in: Ensure that we use MariaDB as suffix include/mysql/plugin.h: Changed types to 'const unsigned char* to get rid of compiler warnings (in other parts of the code) Change length for not \0 terminated string to size_t include/mysql/plugin.h.pp: Update related to plugin.h libmysql/libmysql.c: Fixed bug that caused core dump with newer gcc when strict aliasing is not turned off mysql-test/t/information_schema.test: Test is depending on innodb mysql-test/t/not_partition.test: Fixed wrong directory name (Not noticed before as we don't ususally run this test) mysys/lf_hash.c: Got rid of compiler warnings from -Wstrict-aliasing mysys/my_redel.c: Removed not used variable regex/engine.c: Changed types to 'const char* to get rid of compiler warnings regex/engine.ih: Changed types to 'const char* to get rid of compiler warnings sql/sp_head.cc: Got rid of compiler warning from -Wstrict-aliasing sql/sql_base.cc: Got rid of compiler warnings from -Wstrict-aliasing (The original code was probably wrong as nj_col->table_field was sql/sql_builtin.cc.in: plugin.h needs to have size_t defined sql/sql_parse.cc: Remove used variable sql/sql_select.cc: Got rid of compiler warnings from -Wstrict-aliasing sql/sql_show.cc: Added #ifdef to get rid of compiler warning when not using partition engine sql/table.cc: Got rid of compiler warning from -Wstrict-aliasing storage/maria/ha_maria.cc: Got rid of compiler warnings from -Wstrict-aliasing: - Use the thd_killed() API function storage/maria/lockman.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/ma_check.c: Got rid of compiler warnings from -Wstrict-aliasing Change to use new version of _ma_killed_ptr; Don't call it as often as before storage/maria/ma_check_standalone.h: Update to compatible _ma_killed_ptr() from ha_maria.cc storage/maria/ma_ft_boolean_search.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_ft_nlq_search.c: Got rid of compiler warnings from -Wstrict-aliasing Ensure that 'subkeys' is 32 bit storage/maria/ma_ft_parser.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_ftdefs.h: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/maria/ma_sort.c: Change to use new version of _ma_killed_ptr; Don't call it as often as before storage/maria/ma_state.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/maria_def.h: Redefine ma_killed_ptr() storage/maria/maria_ftdump.c: Got rid of compiler warnings from -Wstrict-aliasing storage/maria/trnman.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/ft_boolean_search.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ft_nlq_search.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/ft_parser.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ft_stopwords.c: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ftdefs.h: Changed pointers from char -> const char* and length to size_t (to get rid of compiler warnings and casts) storage/myisam/ha_myisam.cc: Got rid of compiler warnings from -Wstrict-aliasing: - Use the thd_killed() API function storage/myisam/mi_check.c: Use new killed_ptr() function storage/myisam/myisam_ftdump.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/myisamchk.c: Update to compatible killed_ptr() from ha_myisam.cc storage/myisam/myisamdef.h: Redefine killed_ptr() storage/myisam/myisamlog.c: Got rid of compiler warnings from -Wstrict-aliasing storage/myisam/sort.c: Change to use new version of killed_ptr; Don't call it as often as before storage/xtradb/fil/fil0fil.c: Fixedc ompiler warning storage/xtradb/trx/trx0i_s.c: Include mysql_plugin.h later to ensure that size_t is defined
124 lines
3.4 KiB
C
124 lines
3.4 KiB
C
/* Copyright (C) 2000 MySQL AB
|
|
|
|
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
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
|
|
#include "mysys_priv.h"
|
|
#include "mysys_err.h"
|
|
#include <my_dir.h>
|
|
#include <m_string.h>
|
|
#include "mysys_err.h"
|
|
#if defined(HAVE_UTIME_H)
|
|
#include <utime.h>
|
|
#elif defined(HAVE_SYS_UTIME_H)
|
|
#include <sys/utime.h>
|
|
#elif !defined(HPUX10)
|
|
struct utimbuf {
|
|
time_t actime;
|
|
time_t modtime;
|
|
};
|
|
#endif
|
|
|
|
/*
|
|
Rename with copy stat form old file
|
|
Copy stats from old file to new file, deletes orginal and
|
|
changes new file name to old file name
|
|
|
|
if MY_REDEL_MAKE_COPY is given, then the orginal file
|
|
is renamed to org_name-'current_time'.BAK
|
|
*/
|
|
|
|
#define REDEL_EXT ".BAK"
|
|
|
|
int my_redel(const char *org_name, const char *tmp_name, myf MyFlags)
|
|
{
|
|
int error=1;
|
|
DBUG_ENTER("my_redel");
|
|
DBUG_PRINT("my",("org_name: '%s' tmp_name: '%s' MyFlags: %d",
|
|
org_name,tmp_name,MyFlags));
|
|
|
|
if (my_copystat(org_name,tmp_name,MyFlags) < 0)
|
|
goto end;
|
|
if (MyFlags & MY_REDEL_MAKE_BACKUP)
|
|
{
|
|
char name_buff[FN_REFLEN+20];
|
|
char ext[20];
|
|
ext[0]='-';
|
|
get_date(ext+1,2+4,(time_t) 0);
|
|
strmov(strend(ext),REDEL_EXT);
|
|
if (my_rename(org_name, fn_format(name_buff, org_name, "", ext, 2),
|
|
MyFlags))
|
|
goto end;
|
|
}
|
|
else if (my_delete_allow_opened(org_name, MyFlags))
|
|
goto end;
|
|
if (my_rename(tmp_name,org_name,MyFlags))
|
|
goto end;
|
|
|
|
error=0;
|
|
end:
|
|
DBUG_RETURN(error);
|
|
} /* my_redel */
|
|
|
|
|
|
/* Copy stat from one file to another */
|
|
/* Return -1 if can't get stat, 1 if wrong type of file */
|
|
|
|
int my_copystat(const char *from, const char *to, int MyFlags)
|
|
{
|
|
struct stat statbuf;
|
|
|
|
if (stat((char*) from, &statbuf))
|
|
{
|
|
my_errno=errno;
|
|
if (MyFlags & (MY_FAE+MY_WME))
|
|
my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),from,errno);
|
|
return -1; /* Can't get stat on input file */
|
|
}
|
|
if ((statbuf.st_mode & S_IFMT) != S_IFREG)
|
|
return 1;
|
|
VOID(chmod(to, statbuf.st_mode & 07777)); /* Copy modes */
|
|
|
|
#if !defined(__WIN__) && !defined(__NETWARE__)
|
|
if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING)
|
|
{
|
|
if (MyFlags & MY_LINK_WARNING)
|
|
my_error(EE_LINK_WARNING,MYF(ME_BELL+ME_WAITTANG),from,statbuf.st_nlink);
|
|
}
|
|
if (chown(to, statbuf.st_uid, statbuf.st_gid))
|
|
{
|
|
my_error(EE_CANT_COPY_OWNERSHIP, MYF(ME_JUST_WARNING), to);
|
|
}
|
|
#endif /* !__WIN__ && !__NETWARE__ */
|
|
|
|
#ifndef VMS
|
|
#ifndef __ZTC__
|
|
if (MyFlags & MY_COPYTIME)
|
|
{
|
|
struct utimbuf timep;
|
|
timep.actime = statbuf.st_atime;
|
|
timep.modtime = statbuf.st_mtime;
|
|
VOID(utime((char*) to, &timep));/* Update last accessed and modified times */
|
|
}
|
|
#else
|
|
if (MyFlags & MY_COPYTIME)
|
|
{
|
|
time_t time[2];
|
|
time[0]= statbuf.st_atime;
|
|
time[1]= statbuf.st_mtime;
|
|
VOID(utime((char*) to, time));/* Update last accessed and modified times */
|
|
}
|
|
#endif
|
|
#endif
|
|
return 0;
|
|
} /* my_copystat */
|