summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in7
-rw-r--r--include/my_global.h4
-rw-r--r--myisam/mi_extra.c6
-rw-r--r--mysql-test/include/windows.inc4
-rw-r--r--mysql-test/r/lowercase_table.result6
-rw-r--r--mysql-test/r/windows.result8
-rw-r--r--mysql-test/t/lowercase_table.test10
-rw-r--r--mysql-test/t/windows.test20
-rw-r--r--mysys/my_access.c2
-rw-r--r--sql/examples/ha_tina.cc2
10 files changed, 48 insertions, 21 deletions
diff --git a/configure.in b/configure.in
index 849127661bb..97e07baffd4 100644
--- a/configure.in
+++ b/configure.in
@@ -1957,6 +1957,13 @@ AC_CACHE_CHECK([style of gethost* routines], mysql_cv_gethost_style,
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
+# Test whether madvise() is declared in C++ code -- it is not on some
+# systems, such as Solaris
+AC_CHECK_DECLS(madvise, [], [], [#if HAVE_SYS_MMAN_H
+#include <sys/types.h>
+#include <sys/mman.h>
+#endif])
+
# Do not treat warnings as errors if we are linking against other libc
# this is to work around gcc not being permissive on non-system includes
# with respect to ANSI C++
diff --git a/include/my_global.h b/include/my_global.h
index dcf7e648b5e..a4177f8ea7c 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -331,6 +331,10 @@ C_MODE_END
#undef setrlimit
#define setrlimit cma_setrlimit64
#endif
+/* Declare madvise where it is not declared for C++, like Solaris */
+#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus)
+extern "C" int madvise(void *addr, size_t len, int behav);
+#endif
#ifdef __QNXNTO__
/* This has to be after include limits.h */
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index bfe1748af01..7c0dd13b870 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -62,7 +62,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
if (share->base.blobs)
mi_alloc_rec_buff(info, -1, &info->rec_buff);
-#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
+#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
#endif
@@ -93,7 +93,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
my_errno=EACCES;
break;
}
-#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
+#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if ((share->options & HA_OPTION_COMPRESS_RECORD))
{
pthread_mutex_lock(&share->intern_lock);
@@ -177,7 +177,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
error=end_io_cache(&info->rec_cache);
/* Sergei will insert full text index caching here */
}
-#if defined(HAVE_MMAP) && defined(HAVE_MADVICE)
+#if defined(HAVE_MMAP) && defined(HAVE_MADVISE)
if (info->opt_flag & MEMMAP_USED)
madvise(share->file_map,share->state.state.data_file_length,MADV_RANDOM);
#endif
diff --git a/mysql-test/include/windows.inc b/mysql-test/include/windows.inc
new file mode 100644
index 00000000000..05ec7b0e021
--- /dev/null
+++ b/mysql-test/include/windows.inc
@@ -0,0 +1,4 @@
+--require r/true.require
+disable_query_log;
+select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") as "TRUE";
+enable_query_log;
diff --git a/mysql-test/r/lowercase_table.result b/mysql-test/r/lowercase_table.result
index c09750ed561..7705961d08d 100644
--- a/mysql-test/r/lowercase_table.result
+++ b/mysql-test/r/lowercase_table.result
@@ -84,9 +84,3 @@ create table t2 like T1;
drop table t1, t2;
show tables;
Tables_in_test
-use lpt1;
-ERROR 42000: Unknown database 'lpt1'
-use com1;
-ERROR 42000: Unknown database 'com1'
-use prn;
-ERROR 42000: Unknown database 'prn'
diff --git a/mysql-test/r/windows.result b/mysql-test/r/windows.result
new file mode 100644
index 00000000000..039c5b1476e
--- /dev/null
+++ b/mysql-test/r/windows.result
@@ -0,0 +1,8 @@
+use lpt1;
+ERROR 42000: Unknown database 'lpt1'
+use com1;
+ERROR 42000: Unknown database 'com1'
+use prn;
+ERROR 42000: Unknown database 'prn'
+create table nu (a int);
+drop table nu;
diff --git a/mysql-test/t/lowercase_table.test b/mysql-test/t/lowercase_table.test
index e6f681e4f90..96437bc7636 100644
--- a/mysql-test/t/lowercase_table.test
+++ b/mysql-test/t/lowercase_table.test
@@ -84,14 +84,4 @@ drop table t1, t2;
show tables;
-#
-#Bug 9148: Denial of service
-#
---error 1049
-use lpt1;
---error 1049
-use com1;
---error 1049
-use prn;
-
# End of 4.1 tests
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
new file mode 100644
index 00000000000..d6bcfeb8cb3
--- /dev/null
+++ b/mysql-test/t/windows.test
@@ -0,0 +1,20 @@
+# Windows-specific tests
+--source include/windows.inc
+
+#
+# Bug 9148: Denial of service
+#
+--error 1049
+use lpt1;
+--error 1049
+use com1;
+--error 1049
+use prn;
+
+#
+# Bug #12325: Can't create table named 'nu'
+#
+create table nu (a int);
+drop table nu;
+
+# End of 4.1 tests
diff --git a/mysys/my_access.c b/mysys/my_access.c
index 256749ed447..99e7a28914d 100644
--- a/mysys/my_access.c
+++ b/mysys/my_access.c
@@ -105,7 +105,7 @@ int check_if_legal_filename(const char *path)
{
if (*reserved != my_toupper(&my_charset_latin1, *name))
break;
- if (++name == end)
+ if (++name == end && !reserved[1])
DBUG_RETURN(1); /* Found wrong path */
} while (*++reserved);
}
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 26cd3d2a07e..74ff3457cd2 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -650,7 +650,7 @@ int ha_tina::rnd_init(bool scan)
current_position= next_position= 0;
records= 0;
chain_ptr= chain;
-#ifdef MADV_SEQUENTIAL
+#ifdef HAVE_MADVISE
(void)madvise(share->mapped_file,share->file_stat.st_size,MADV_SEQUENTIAL);
#endif