Merge remote-tracking branch 'freemine/fix_unnecessary_mkdir_failure' into doc/contrib

This commit is contained in:
Shengliang Guan 2024-10-30 19:44:18 +08:00
commit 25176bb477
1 changed files with 7 additions and 2 deletions

View File

@ -223,10 +223,15 @@ int32_t taosMulModeMkDir(const char *dirname, int mode, bool checkAccess) {
if (checkAccess && taosCheckAccessFile(temp, TD_FILE_ACCESS_EXIST_OK | TD_FILE_ACCESS_READ_OK | TD_FILE_ACCESS_WRITE_OK)) { if (checkAccess && taosCheckAccessFile(temp, TD_FILE_ACCESS_EXIST_OK | TD_FILE_ACCESS_READ_OK | TD_FILE_ACCESS_WRITE_OK)) {
return 0; return 0;
} }
code = chmod(temp, mode); code = chmod(temp, mode);
if (-1 == code) { if (-1 == code) {
terrno = TAOS_SYSTEM_ERROR(errno); struct stat statbuf = {0};
return terrno; code = stat(temp, &statbuf);
if (code != 0 || (statbuf.st_mode & mode) != mode) {
terrno = TAOS_SYSTEM_ERROR(errno);
return terrno;
}
} }
} }