mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
configure.in:
Let MySQL check the existence of readdir_r with 3 arguments; Solaris seems to have just 2 args Check the existence of readdir_r and localtime_r; even though MySQL does check these too, we need our own check for Hot Backup code os0file.c: Use re-entrant readdir_r where available ut0ut.c: Make a function to use thread-safe localtime_r where available; that particular function was not called from anywhere, though
This commit is contained in:
parent
a38160f370
commit
227ffeb9e0
3 changed files with 38 additions and 3 deletions
|
@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4)
|
||||||
AC_CHECK_SIZEOF(void*, 4)
|
AC_CHECK_SIZEOF(void*, 4)
|
||||||
AC_CHECK_FUNCS(sched_yield)
|
AC_CHECK_FUNCS(sched_yield)
|
||||||
AC_CHECK_FUNCS(fdatasync)
|
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_INLINE Already checked in MySQL
|
||||||
AC_C_BIGENDIAN
|
AC_C_BIGENDIAN
|
||||||
|
|
||||||
|
|
|
@ -711,13 +711,41 @@ http://www.mysql.com/doc/en/Windows_symbolic_links.html */
|
||||||
char* full_path;
|
char* full_path;
|
||||||
int ret;
|
int ret;
|
||||||
struct stat statinfo;
|
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:
|
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) {
|
if (ent == NULL) {
|
||||||
|
/* End of directory */
|
||||||
|
|
||||||
return(1);
|
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);
|
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
|
||||||
|
|
||||||
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
|
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
|
||||||
|
|
|
@ -235,13 +235,18 @@ ut_get_year_month_day(
|
||||||
*month = (ulint)cal_tm.wMonth;
|
*month = (ulint)cal_tm.wMonth;
|
||||||
*day = (ulint)cal_tm.wDay;
|
*day = (ulint)cal_tm.wDay;
|
||||||
#else
|
#else
|
||||||
|
struct tm cal_tm;
|
||||||
struct tm* cal_tm_ptr;
|
struct tm* cal_tm_ptr;
|
||||||
time_t tm;
|
time_t tm;
|
||||||
|
|
||||||
time(&tm);
|
time(&tm);
|
||||||
|
|
||||||
|
#ifdef HAVE_LOCALTIME_R
|
||||||
|
localtime_r(&tm, &cal_tm);
|
||||||
|
cal_tm_ptr = &cal_tm;
|
||||||
|
#else
|
||||||
cal_tm_ptr = localtime(&tm);
|
cal_tm_ptr = localtime(&tm);
|
||||||
|
#endif
|
||||||
*year = (ulint)cal_tm_ptr->tm_year + 1900;
|
*year = (ulint)cal_tm_ptr->tm_year + 1900;
|
||||||
*month = (ulint)cal_tm_ptr->tm_mon + 1;
|
*month = (ulint)cal_tm_ptr->tm_mon + 1;
|
||||||
*day = (ulint)cal_tm_ptr->tm_mday;
|
*day = (ulint)cal_tm_ptr->tm_mday;
|
||||||
|
|
Loading…
Add table
Reference in a new issue