summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-06 11:38:56 +0200
committerunknown <monty@mysql.com>2004-12-06 11:38:56 +0200
commit796bd7de96a1d1ec422708b90df5328388201c10 (patch)
treea7bb331b7dac7ac2b3cda915e99bb8c1333f4fec /innobase
parent289d3b2ee0f912dd4f128e1c61685d7bb170eb90 (diff)
parentf8cdf570979c550ef04c53f691118ed2b1296a7c (diff)
downloadmariadb-git-796bd7de96a1d1ec422708b90df5328388201c10.tar.gz
Merge with 4.1
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union BUILD/SETUP.sh: Auto merged Build-tools/Do-compile: Auto merged client/mysqladmin.cc: Auto merged configure.in: Auto merged innobase/include/lock0lock.h: Auto merged innobase/os/os0file.c: Auto merged libmysqld/Makefile.am: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/r/lowercase_table3.result: Auto merged mysql-test/r/rpl_start_stop_slave.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/t/ctype_ucs.test: Auto merged mysql-test/t/rpl_until.test: Auto merged mysql-test/t/subselect.test: Auto merged ndb/src/kernel/blocks/dblqh/DblqhMain.cpp: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_myisam.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/lock.cc: Auto merged sql/log_event.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/log_event.cc: Merge with 4.1 Trivial cleanup
Diffstat (limited to 'innobase')
-rw-r--r--innobase/configure.in4
-rw-r--r--innobase/include/lock0lock.h2
-rw-r--r--innobase/os/os0file.c30
-rw-r--r--innobase/ut/ut0ut.c7
4 files changed, 39 insertions, 4 deletions
diff --git a/innobase/configure.in b/innobase/configure.in
index d83da9fdc5c..baf11272ab9 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(void*, 4)
AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync)
-#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL
+AC_CHECK_FUNCS(localtime_r)
+#AC_CHECK_FUNCS(readdir_r) MySQL checks that it has also the right args.
+# Some versions of Unix only take 2 arguments.
#AC_C_INLINE Already checked in MySQL
AC_C_BIGENDIAN
diff --git a/innobase/include/lock0lock.h b/innobase/include/lock0lock.h
index d642fe46fef..b99359fe998 100644
--- a/innobase/include/lock0lock.h
+++ b/innobase/include/lock0lock.h
@@ -490,7 +490,7 @@ on the table. */
ibool
lock_is_table_exclusive(
-/*=================*/
+/*====================*/
/* out: TRUE if table is only locked by trx,
with LOCK_IX, and possibly LOCK_AUTO_INC */
dict_table_t* table, /* in: table */
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 7aed4a4ab0e..1e3eeb0de02 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -715,13 +715,41 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
char* full_path;
int ret;
struct stat statinfo;
+#ifdef HAVE_READDIR_R
+ char dirent_buf[sizeof(struct dirent) + _POSIX_PATH_MAX +
+ 100];
+ /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
+ the max file name len; but in most standards, the
+ length is NAME_MAX; we add 100 to be even safer */
+#endif
+
next_file:
- ent = readdir(dir);
+
+#ifdef HAVE_READDIR_R
+ ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
+
+ if (ret != 0) {
+ fprintf(stderr,
+"InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret);
+
+ return(-1);
+ }
if (ent == NULL) {
+ /* End of directory */
+
return(1);
}
+ ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
+#else
+ ent = readdir(dir);
+
+ if (ent == NULL) {
+
+ return(1);
+ }
+#endif
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
diff --git a/innobase/ut/ut0ut.c b/innobase/ut/ut0ut.c
index b67be77b29e..732380bcb1f 100644
--- a/innobase/ut/ut0ut.c
+++ b/innobase/ut/ut0ut.c
@@ -235,13 +235,18 @@ ut_get_year_month_day(
*month = (ulint)cal_tm.wMonth;
*day = (ulint)cal_tm.wDay;
#else
+ struct tm cal_tm;
struct tm* cal_tm_ptr;
time_t tm;
time(&tm);
+#ifdef HAVE_LOCALTIME_R
+ localtime_r(&tm, &cal_tm);
+ cal_tm_ptr = &cal_tm;
+#else
cal_tm_ptr = localtime(&tm);
-
+#endif
*year = (ulint)cal_tm_ptr->tm_year + 1900;
*month = (ulint)cal_tm_ptr->tm_mon + 1;
*day = (ulint)cal_tm_ptr->tm_mday;