From 422b94f107c9dcd6850816b8613804b2df1de77f Mon Sep 17 00:00:00 2001 From: freemine Date: Tue, 25 Apr 2023 07:14:07 +0800 Subject: [PATCH] fix unnecessary mkdir failure --- source/os/src/osDir.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index 3d63da7ba3..2268e88f18 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -206,7 +206,15 @@ int32_t taosMulModeMkDir(const char *dirname, int mode) { #endif if (taosDirExist(temp)) { - return chmod(temp, mode); + int r = chmod(temp, mode); + if (r == 0) return 0; + { + struct stat statbuf = {0}; + int rr = stat(temp, &statbuf); + if (rr) return rr; + if ((statbuf.st_mode & mode) == mode) return 0; + } + return r; } if (strncmp(temp, TD_DIRSEP, 1) == 0) {