diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index aab547223f8d5caf11ec824eeeece978f934ae0d..9833e3ba4577517286618041fd51e8a83edd76d2 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -538,10 +538,11 @@ int32_t taosFStatFile(TdFilePtr pFile, int64_t *size, int32_t *mtime) { return -1; } - struct stat fileStat; #ifdef WINDOWS + struct __stat64 fileStat; int32_t code = _fstat(pFile->fd, &fileStat); #else + struct stat fileStat; int32_t code = fstat(pFile->fd, &fileStat); #endif if (code < 0) { diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 2a18f420cd0a74f6205f522784047c67c547a4b0..d415379f9217368db50e8e6ffadc64ac67fdf4b0 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -347,7 +347,6 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { char name[LOG_FILE_NAME_LEN + 50] = "\0"; int32_t logstat0_mtime, logstat1_mtime; - int32_t size; tsLogObj.maxLines = maxLines; tsLogObj.fileNum = maxFileNum; @@ -395,8 +394,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) { printf("\nfailed to fstat log file:%s, reason:%s\n", fileName, strerror(errno)); return -1; } - size = (int32_t)filesize; - tsLogObj.lines = size / 60; + tsLogObj.lines = (int32_t)(filesize / 60); taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END);