[TD_543] fix coverity scan, cid:267826
This commit is contained in:
parent
a8d35dbc49
commit
45f66a9498
|
@ -191,16 +191,15 @@ void taosResetLog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool taosCheckFileIsOpen(char *logFileName) {
|
static bool taosCheckFileIsOpen(char *logFileName) {
|
||||||
int32_t exist = access(logFileName, F_OK);
|
int32_t fd = open(logFileName, O_WRONLY, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
if (exist != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t fd = open(logFileName, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
if (errno == ENOENT) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
printf("\nfailed to open log file:%s, reason:%s\n", logFileName, strerror(errno));
|
printf("\nfailed to open log file:%s, reason:%s\n", logFileName, strerror(errno));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (taosLockFile(fd)) {
|
if (taosLockFile(fd)) {
|
||||||
taosUnLockFile(fd);
|
taosUnLockFile(fd);
|
||||||
|
|
Loading…
Reference in New Issue