diff options
author | unknown <msvensson@neptunus.(none)> | 2005-05-26 21:01:55 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2005-05-26 21:01:55 +0200 |
commit | 6e79678dee016ab66430f59d5af4f0ff7a860c49 (patch) | |
tree | 32e125a96dccca5fdbf44b1f1215e4285006bdb3 | |
parent | c8b88e8e45770ecae2233a5f9fb3dd2a32e17148 (diff) | |
parent | ab88a1d25a95e04ff0f22ac9e8e3e69d77c428dc (diff) | |
download | mariadb-git-6e79678dee016ab66430f59d5af4f0ff7a860c49.tar.gz |
Merge from 4.1
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e:
Auto merged
BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e:
Auto merged
client/sql_string.cc:
Auto merged
client/sql_string.h:
Auto merged
include/my_global.h:
Auto merged
include/my_sys.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysys/my_open.c:
Auto merged
mysys/raid.cc:
Auto merged
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
Auto merged
sql/field.cc:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_blackhole.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_geofunc.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_uniq.cc:
Auto merged
sql/item_uniq.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/procedure.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/protocol_cursor.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_analyse.cc:
Auto merged
sql/sql_analyse.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_map.cc:
Auto merged
sql/sql_olap.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
sql/tztime.cc:
Auto merged
sql/opt_range.cc:
Manual merge
sql/sql_parse.cc:
Use select_lex pointer instead of lex->select_lex
sql/sql_repl.cc:
Function moved to log.cc, fix made there instead
sql/sql_class.cc:
Auto merged
sql/sql_select.cc:
Auto merged
53 files changed, 181 insertions, 103 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc index 0424723d97f..51f802e7465 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/client/sql_string.h b/client/sql_string.h index 2debeb61787..242b31e7ed6 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/include/my_global.h b/include/my_global.h index 98a47a621ca..b4dfb5b7f7d 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -48,6 +48,11 @@ #define USE_PRAGMA_INTERFACE #endif +/* Determine when to use "#pragma implementation" */ +#if !defined(__INTEL_COMPILER) && defined(__GNUC__) && (__GNUC__ < 3) +#define USE_PRAGMA_IMPLEMENTATION +#endif + #if defined(i386) && !defined(__i386__) #define __i386__ #endif diff --git a/include/my_sys.h b/include/my_sys.h index 10358470c77..62affb31740 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -605,6 +605,7 @@ extern int my_access(const char *path, int amode); #else #define my_access access #endif +extern int check_if_legal_filename(const char *path); #ifndef TERMINATE extern void TERMINATE(FILE *file); diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index cd1e634a831..45b1e948ac2 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1212,8 +1212,8 @@ start_master() $NOT_FIRST_MASTER_EXTRA_OPTS" fi - CUR_MYERR=$MASTER_MYERR - CUR_MYSOCK=$MASTER_MYSOCK + CUR_MYERR=$MASTER_MYERR$1 + CUR_MYSOCK=$MASTER_MYSOCK$1 # For embedded server we collect the server flags and return if [ "x$USE_EMBEDDED_SERVER" = "x1" ] ; then diff --git a/mysys/my_access.c b/mysys/my_access.c index 6a8887e42a6..28210bdfc7d 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -15,39 +15,107 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "mysys_priv.h" +#include <m_string.h> #ifdef __WIN__ /* - * Check a file or path for accessability. - * - * SYNOPSIS - * file_access() - * pathpath to check - * amodemode to check - * - * DESCRIPTION - * This function wraps the normal access method because the access - * available in MSVCRT> +reports that filenames such as LPT1 and - * COM1 are valid (they are but should not be so for us). - * - * RETURN VALUES - * 0 ok - * -1 error - */ + Check a file or path for accessability. + + SYNOPSIS + file_access() + path Path to file + amode Access method + + DESCRIPTION + This function wraps the normal access method because the access + available in MSVCRT> +reports that filenames such as LPT1 and + COM1 are valid (they are but should not be so for us). + + RETURN VALUES + 0 ok + -1 error (We use -1 as my_access is mapped to access on other platforms) +*/ + int my_access(const char *path, int amode) { - WIN32_FILE_ATTRIBUTE_DATA fileinfo; - BOOL result; + WIN32_FILE_ATTRIBUTE_DATA fileinfo; + BOOL result; - result = GetFileAttributesEx(path, GetFileExInfoStandard, - &fileinfo); - if (! result) - return -1; - if ((fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && - (amode & 2)) - return -1; - return 0; + result= GetFileAttributesEx(path, GetFileExInfoStandard, &fileinfo); + if (! result || + (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_READONLY) && (amode & W_OK)) + { + my_errno= errno= EACCES; + return -1; + } + return 0; } +#endif /* __WIN__ */ + +#if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) + +/* + List of file names that causes problem on windows + + NOTE that one can also not have file names of type CON.TXT +*/ + +static const char *reserved_names[]= +{ + "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", + "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", + "LPT7", "LPT8", "LPT9", "CLOCK$", + NullS +}; + +#define MAX_RESERVED_NAME_LENGTH 6 + +/* + Check if a path will access a reserverd file name that may cause problems + + SYNOPSIS + check_if_legal_filename + path Path to file + + RETURN + 0 ok + 1 reserved file name +*/ + +int check_if_legal_filename(const char *path) +{ + const char *end; + const char **reserved_name; + DBUG_ENTER("check_if_legal_filename"); + + path+= dirname_length(path); /* To start of filename */ + if (!(end= strchr(path, FN_EXTCHAR))) + end= strend(path); + if (path == end || (uint) (path - end) > MAX_RESERVED_NAME_LENGTH) + DBUG_RETURN(0); /* Simplify inner loop */ + + for (reserved_name= reserved_names; *reserved_name; reserved_name++) + { + const char *name= path; + while (name != end) + { + if (my_toupper(&my_charset_latin1, *path) != + my_toupper(&my_charset_latin1, *name)) + break; + if (name++ == end) + DBUG_RETURN(1); /* Found wrong path */ + } + } + DBUG_RETURN(0); +} #endif + + +#ifdef OS2 +int check_if_legal_filename(const char *path) +{ + return 0; +} +#endif /* OS2 */ diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index 4310250bd0d..3c6f1b15384 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -39,13 +39,16 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags) very well */ #ifdef __WIN__ - if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) - fd=0; + if (check_if_legal_filename(FileName)) + { + errno= EACCES; + fd= 0; + } else #endif { - make_ftype(type,Flags); - fd = fopen(FileName, type); + make_ftype(type,Flags); + fd = fopen(FileName, type); } if (fd != 0) diff --git a/mysys/my_open.c b/mysys/my_open.c index 7fc5282838f..69d63c49554 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -47,12 +47,15 @@ File my_open(const char *FileName, int Flags, myf MyFlags) FileName, Flags, MyFlags)); #if defined(MSDOS) || defined(__WIN__) || defined(__EMX__) || defined(OS2) /* - if we are not creating, then we need to use my_access to make - sure the file exists since Windows doesn't handle files like - "com1.sym" very well + Check that we don't try to open or create a file name that may + cause problems for us in the future (like PRN) */ - if (! (Flags & O_CREAT) && my_access(FileName, F_OK)) - return -1; + if (check_if_legal_filename(FileName)) + { + errno= EACCES; + DBUG_RETURN(my_register_filename(-1, FileName, FILE_BY_OPEN, + EE_FILENOTFOUND, MyFlags)); + } if (Flags & O_SHARE) fd = sopen((my_string) FileName, (Flags & ~O_SHARE) | O_BINARY, SH_DENYNO, MY_S_IREAD | MY_S_IWRITE); diff --git a/mysys/raid.cc b/mysys/raid.cc index 1d2e0cb01f0..29819a878c4 100644 --- a/mysys/raid.cc +++ b/mysys/raid.cc @@ -70,7 +70,7 @@ tonu@mysql.com & monty@mysql.com */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp index 5c12472a0f7..d4a44b9e641 100644 --- a/ndb/src/kernel/blocks/dbtux/Dbtux.hpp +++ b/ndb/src/kernel/blocks/dbtux/Dbtux.hpp @@ -342,7 +342,6 @@ private: * Complete metadata for one index. The array of attributes has * variable size. */ - struct DescEnt; friend struct DescEnt; struct DescEnt { DescHead m_descHead; diff --git a/sql/field.cc b/sql/field.cc index 54ed4044de5..0c7fed99493 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -19,7 +19,7 @@ ** This file implements classes defined in field.h *****************************************************************************/ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc index 725674946ee..5942973c732 100644 --- a/sql/ha_berkeley.cc +++ b/sql/ha_berkeley.cc @@ -47,7 +47,7 @@ */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_blackhole.cc b/sql/ha_blackhole.cc index dcc542a7247..6a841801487 100644 --- a/sql/ha_blackhole.cc +++ b/sql/ha_blackhole.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc index e3212b095cf..cd655eeb0a9 100644 --- a/sql/ha_heap.cc +++ b/sql/ha_heap.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index 381c9c28a79..7614744ddf6 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -27,7 +27,7 @@ have disables the InnoDB inlining in this file. */ in Windows? */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 2049efb73db..1352fd84d9d 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_myisammrg.cc b/sql/ha_myisammrg.cc index f7c0abf9810..0796ded3ac0 100644 --- a/sql/ha_myisammrg.cc +++ b/sql/ha_myisammrg.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index 6ccaa668df9..208c97ccd7f 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -20,7 +20,7 @@ NDB Cluster */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/handler.cc b/sql/handler.cc index b2ab2003165..965c3d26f49 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -17,7 +17,7 @@ /* Handler-calling-functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc index b85f8054f10..ec200768222 100644 --- a/sql/hash_filo.cc +++ b/sql/hash_filo.cc @@ -20,7 +20,7 @@ ** to usage. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item.cc b/sql/item.cc index 77ea7b85ab0..bf62aa1ddad 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 89897a9d74f..8761f8076ca 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -17,7 +17,7 @@ /* This file defines all compare functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_func.cc b/sql/item_func.cc index db2aa735b0e..72a4dff74e5 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -17,7 +17,7 @@ /* This file defines all numerical functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index b9f2ec8a6ca..e2b0eb5ce07 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -17,7 +17,7 @@ /* This file defines all spatial functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 857140dba8f..e870fe5aa43 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -20,7 +20,7 @@ ** (This shouldn't be needed) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 0fbcf32a83c..29c52e73159 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -22,7 +22,7 @@ SUBSELECT TODO: (sql_select.h/sql_select.cc) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 85abb09531b..b9f3cc49d64 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -17,7 +17,7 @@ /* Sum functions (COUNT, MIN...) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 7a9c7898856..3b6ca48fadd 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -17,7 +17,7 @@ /* This file defines all time functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/item_uniq.cc b/sql/item_uniq.cc index c1a19d71d04..8734e671817 100644 --- a/sql/item_uniq.cc +++ b/sql/item_uniq.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Compability file */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation #endif diff --git a/sql/item_uniq.h b/sql/item_uniq.h index 602474f7581..14b2e8d53bb 100644 --- a/sql/item_uniq.h +++ b/sql/item_uniq.h @@ -16,7 +16,7 @@ /* Compability file ; This file only contains dummy functions */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface #endif diff --git a/sql/log_event.cc b/sql/log_event.cc index 42134d2b990..e9897607800 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -16,7 +16,7 @@ #ifndef MYSQL_CLIENT -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif #include "mysql_priv.h" diff --git a/sql/log_event.h b/sql/log_event.h index f8989c4994a..b163a37e7cc 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -22,7 +22,7 @@ #undef write // remove pthread.h macro definition, conflict with write() class member #endif -#if defined(__GNUC__) && !defined(MYSQL_CLIENT) +#if defined(USE_PRAGMA_INTERFACE) && !defined(MYSQL_CLIENT) #pragma interface /* gcc class implementation */ #endif diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0aa0468fc36..5718ab5e010 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -36,7 +36,7 @@ QUICK_RANGEs are also created in this step. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/procedure.cc b/sql/procedure.cc index a31b93da358..554e2cd0565 100644 --- a/sql/procedure.cc +++ b/sql/procedure.cc @@ -17,7 +17,7 @@ /* Procedures (functions with changes output of select) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/protocol.cc b/sql/protocol.cc index 9a96da004c5..57922cdc677 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -19,7 +19,7 @@ The actual communction is handled by the net_xxx functions in net_serv.cc */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/protocol_cursor.cc b/sql/protocol_cursor.cc index 5ac03c4d427..ed2d0b583d0 100644 --- a/sql/protocol_cursor.cc +++ b/sql/protocol_cursor.cc @@ -19,7 +19,7 @@ The actual communction is handled by the net_xxx functions in net_serv.cc */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/set_var.cc b/sql/set_var.cc index b8059779a2a..106fced8e88 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -48,7 +48,7 @@ new attribute. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index 1056bff4315..6706cee8e9d 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -23,7 +23,7 @@ ** - type set is out of optimization yet */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index a0f0df9b43b..9e5926fd9b1 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -17,7 +17,7 @@ /* Analyse database */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 48cdb47a7ff..438bfdbcb73 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -22,7 +22,7 @@ ** *****************************************************************************/ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_crypt.cc b/sql/sql_crypt.cc index b0b8050e311..f21a109e95d 100644 --- a/sql/sql_crypt.cc +++ b/sql/sql_crypt.cc @@ -23,7 +23,7 @@ needs something like 'ssh'. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h index 1b27f0a4d27..25bc2d29e1d 100644 --- a/sql/sql_crypt.h +++ b/sql/sql_crypt.h @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 7c7939eaf60..fb23ded414e 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -423,7 +423,7 @@ static const uint signed_longlong_len=19; static const char *unsigned_longlong_str="18446744073709551615"; static const uint unsigned_longlong_len=20; -inline static uint int_token(const char *str,uint length) +static inline uint int_token(const char *str,uint length) { if (length < long_len) // quick normal case return NUM; diff --git a/sql/sql_list.cc b/sql/sql_list.cc index c99cfb8c918..d57a7dfe4e3 100644 --- a/sql/sql_list.cc +++ b/sql/sql_list.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_map.cc b/sql/sql_map.cc index 4bb3482c7e6..9346f3df305 100644 --- a/sql/sql_map.cc +++ b/sql/sql_map.cc @@ -15,7 +15,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_map.h b/sql/sql_map.h index 632eb6e4f64..bfa6011ac54 100644 --- a/sql/sql_map.h +++ b/sql/sql_map.h @@ -17,7 +17,7 @@ /* interface for memory mapped files */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_INTERFACE #pragma interface /* gcc class implementation */ #endif diff --git a/sql/sql_olap.cc b/sql/sql_olap.cc index 07271d40492..8ac0a36b03f 100644 --- a/sql/sql_olap.cc +++ b/sql/sql_olap.cc @@ -28,7 +28,7 @@ #ifdef DISABLED_UNTIL_REWRITTEN_IN_4_1 -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7078c8e7181..5a06364cd22 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3180,7 +3180,7 @@ unsent_create_error: if (!(res= open_and_lock_tables(thd, all_tables))) { /* Skip first table, which is the table we are inserting in */ - lex->select_lex.table_list.first= (byte*)first_table->next_local; + select_lex->table_list.first= (byte*)first_table->next_local; res= mysql_insert_select_prepare(thd); if (!res && (result= new select_insert(first_table, first_table->table, @@ -3192,13 +3192,13 @@ unsent_create_error: insert/replace from SELECT give its SELECT_LEX for SELECT, and item_list belong to SELECT */ - lex->select_lex.resolve_mode= SELECT_LEX::SELECT_MODE; + select_lex->resolve_mode= SELECT_LEX::SELECT_MODE; res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE); - lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE; + select_lex->resolve_mode= SELECT_LEX::INSERT_MODE; delete result; } /* revert changes for SP */ - lex->select_lex.table_list.first= (byte*) first_table; + select_lex->table_list.first= (byte*) first_table; } if (first_table->view && !first_table->contain_auto_increment) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index ca67b09fdc8..71cebb61ae6 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1479,13 +1479,11 @@ bool show_binlogs(THD* thd) { IO_CACHE *index_file; LOG_INFO cur; - IO_CACHE log; File file; - const char *errmsg= 0; - MY_STAT stat_area; char fname[FN_REFLEN]; List<Item> field_list; uint length; + int cur_dir_len; Protocol *protocol= thd->protocol; DBUG_ENTER("show_binlogs"); @@ -1505,34 +1503,35 @@ bool show_binlogs(THD* thd) index_file=mysql_bin_log.get_index_file(); mysql_bin_log.get_current_log(&cur); - int cur_dir_len = dirname_length(cur.log_file_name); + cur_dir_len= dirname_length(cur.log_file_name); reinit_io_cache(index_file, READ_CACHE, (my_off_t) 0, 0, 0); /* The file ends with EOF or empty line */ while ((length=my_b_gets(index_file, fname, sizeof(fname))) > 1) { - fname[--length] = '\0'; /* remove the newline */ + int dir_len; + ulonglong file_length= 0; // Length if open fails + fname[--length] = '\0'; // remove the newline protocol->prepare_for_resend(); - int dir_len = dirname_length(fname); - protocol->store(fname + dir_len, length-dir_len, &my_charset_bin); - if(!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length-dir_len))) + dir_len= dirname_length(fname); + length-= dir_len; + protocol->store(fname + dir_len, length, &my_charset_bin); + + if (!(strncmp(fname+dir_len, cur.log_file_name+cur_dir_len, length))) + file_length= cur.pos; /* The active log, use the active position */ + else { - /* this is the active log, use the active position */ - protocol->store((ulonglong) cur.pos); - } else { /* this is an old log, open it and find the size */ - if ((file=open_binlog(&log, fname+dir_len, &errmsg)) >= 0) + if ((file= my_open(fname+dir_len, O_RDONLY | O_SHARE | O_BINARY, + MYF(0))) >= 0) { - protocol->store((ulonglong) my_b_filelength(&log)); - end_io_cache(&log); + file_length= (ulonglong) my_seek(file, 0L, MY_SEEK_END, MYF(0)); my_close(file, MYF(0)); - } else { - /* the file wasn't openable, but 0 is an invalid value anyway */ - protocol->store((ulonglong) 0); } } + protocol->store(file_length); if (protocol->write()) goto err; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index c68379baa75..be2c89c4b17 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -17,7 +17,7 @@ /* mysql_select and join optimization */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 0424723d97f..51f802e7465 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -16,7 +16,7 @@ /* This file is originally from the mysql distribution. Coded by monty */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index 1e1a5683d09..03d54b60318 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -28,7 +28,7 @@ dynamic functions, so this shouldn't be a real problem. */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: implement sql_udf.h #endif diff --git a/sql/tztime.cc b/sql/tztime.cc index 983c630071e..11cdf64de29 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -20,7 +20,7 @@ (We will refer to this code as to elsie-code further.) */ -#ifdef __GNUC__ +#ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation #endif |