提交 1cb06800 编写于 作者: wafwerar's avatar wafwerar

fix: make mul dir error.

上级 f937c5b8
......@@ -38,6 +38,7 @@ typedef struct TdDirEntry *TdDirEntryPtr;
void taosRemoveDir(const char *dirname);
bool taosDirExist(char *dirname);
int32_t taosMkDir(const char *dirname);
int32_t taosMulMkDir(const char *dirname);
void taosRemoveOldFiles(const char *dirname, int32_t keepDays);
int32_t taosExpandDir(const char *dirname, char *outname, int32_t maxlen);
int32_t taosRealPath(char *dirname, int32_t maxlen);
......
......@@ -616,7 +616,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
taosSetAllDebugFlag(cfgGetItem(pCfg, "debugFlag")->i32);
if (taosMkDir(tsLogDir) != 0) {
if (taosMulMkDir(tsLogDir) != 0) {
uError("failed to create dir:%s since %s", tsLogDir, terrstr());
cfgCleanup(pCfg);
return -1;
......
......@@ -68,6 +68,15 @@ void taosRemoveDir(const char *dirname) {
bool taosDirExist(char *dirname) { return taosCheckExistFile(dirname); }
int32_t taosMkDir(const char *dirname) {
int32_t code = mkdir(dirname, 0755);
if (code < 0 && errno == EEXIST) {
return 0;
}
return code;
}
int32_t taosMulMkDir(const char *dirname) {
if (dirname == NULL) return -1;
char *temp = strdup(dirname);
char *pos = temp;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册