From c8c30e0a00c508faf6a8428846516386124b9f47 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 25 Aug 2023 10:15:52 +0800 Subject: [PATCH] fix --- include/os/osDir.h | 2 +- source/os/src/osDir.c | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/os/osDir.h b/include/os/osDir.h index 2542f9830f..533ac8e4a4 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -83,7 +83,7 @@ void taosRemoveDir(const char *dirname); bool taosDirExist(const char *dirname); int32_t taosMkDir(const char *dirname); int32_t taosMulMkDir(const char *dirname); -int32_t taosMulModeMkDir(const char *dirname, int mode, bool createLogFile); +int32_t taosMulModeMkDir(const char *dirname, int mode, bool checkAccess); void taosRemoveOldFiles(const char *dirname, int32_t keepDays); int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen); int32_t taosRealPath(char *dirname, char *realPath, int32_t maxlen); diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index e9f8c7f7e6..d0fb7ee919 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -193,7 +193,7 @@ int32_t taosMulMkDir(const char *dirname) { return code; } -int32_t taosMulModeMkDir(const char *dirname, int mode, bool createLogFile) { +int32_t taosMulModeMkDir(const char *dirname, int mode, bool checkAccess) { if (dirname == NULL || strlen(dirname) >= TDDIRMAXLEN) return -1; char temp[TDDIRMAXLEN]; char *pos = temp; @@ -206,14 +206,10 @@ int32_t taosMulModeMkDir(const char *dirname, int mode, bool createLogFile) { #endif if (taosDirExist(temp)) { - if (createLogFile) { - if (!taosCheckAccessFile(temp, TD_FILE_ACCESS_EXIST_OK | TD_FILE_ACCESS_READ_OK | TD_FILE_ACCESS_WRITE_OK)) { - code = -1; - } + if (checkAccess && taosCheckAccessFile(temp, TD_FILE_ACCESS_EXIST_OK | TD_FILE_ACCESS_READ_OK | TD_FILE_ACCESS_WRITE_OK)) { return code; - } else { - return chmod(temp, mode); } + return chmod(temp, mode); } if (strncmp(temp, TD_DIRSEP, 1) == 0) {