mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
Merge dev3-76.dev.cn.tlan:/home/dli/mysql/mysql-5.0/mysql-5.0-ndb-bj
into dev3-76.dev.cn.tlan:/home/dli/mysql/mysql-5.0/mysql-5.0-bug-21345
This commit is contained in:
commit
d6600600d1
3 changed files with 30 additions and 1 deletions
|
@ -28,6 +28,14 @@
|
||||||
class File_class
|
class File_class
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* Returns time for last contents modification of a file.
|
||||||
|
*
|
||||||
|
* @param aFileName a filename to check.
|
||||||
|
* @return the time for last contents modificaton of the file.
|
||||||
|
*/
|
||||||
|
static time_t mtime(const char* aFileName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the file exist.
|
* Returns true if the file exist.
|
||||||
*
|
*
|
||||||
|
|
|
@ -147,6 +147,7 @@ FileLogHandler::createNewFile()
|
||||||
bool rc = true;
|
bool rc = true;
|
||||||
int fileNo = 1;
|
int fileNo = 1;
|
||||||
char newName[PATH_MAX];
|
char newName[PATH_MAX];
|
||||||
|
time_t newMtime, preMtime = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -159,7 +160,15 @@ FileLogHandler::createNewFile()
|
||||||
}
|
}
|
||||||
BaseString::snprintf(newName, sizeof(newName),
|
BaseString::snprintf(newName, sizeof(newName),
|
||||||
"%s.%d", m_pLogFile->getName(), fileNo++);
|
"%s.%d", m_pLogFile->getName(), fileNo++);
|
||||||
|
newMtime = File_class::mtime(newName);
|
||||||
|
if (newMtime < preMtime)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
preMtime = newMtime;
|
||||||
|
}
|
||||||
} while (File_class::exists(newName));
|
} while (File_class::exists(newName));
|
||||||
|
|
||||||
m_pLogFile->close();
|
m_pLogFile->close();
|
||||||
|
|
|
@ -24,6 +24,18 @@
|
||||||
//
|
//
|
||||||
// PUBLIC
|
// PUBLIC
|
||||||
//
|
//
|
||||||
|
time_t
|
||||||
|
File_class::mtime(const char* aFileName)
|
||||||
|
{
|
||||||
|
MY_STAT stmp;
|
||||||
|
time_t rc = 0;
|
||||||
|
|
||||||
|
if (my_stat(aFileName, &stmp, MYF(0)) != NULL) {
|
||||||
|
rc = stmp.st_mtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
File_class::exists(const char* aFileName)
|
File_class::exists(const char* aFileName)
|
||||||
|
|
Loading…
Add table
Reference in a new issue