[TD_543] fix coverity scan, cid:267826

This commit is contained in:
Shengliang Guan 2020-06-08 15:07:48 +00:00
parent a8d35dbc49
commit 45f66a9498
1 changed files with 7 additions and 8 deletions

View File

@ -191,15 +191,14 @@ void taosResetLog() {
}
static bool taosCheckFileIsOpen(char *logFileName) {
int32_t exist = access(logFileName, F_OK);
if (exist != 0) {
return false;
}
int32_t fd = open(logFileName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
int32_t fd = open(logFileName, O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
if (fd < 0) {
printf("\nfailed to open log file:%s, reason:%s\n", logFileName, strerror(errno));
return true;
if (errno == ENOENT) {
return false;
} else {
printf("\nfailed to open log file:%s, reason:%s\n", logFileName, strerror(errno));
return true;
}
}
if (taosLockFile(fd)) {