diff --git a/src/client/src/tscSub.c b/src/client/src/tscSub.c index 9baf49ff211667e8fd83b5494824aa8ba793aba0..1a1305825bb32cd3a300e990a33cca52ec7633b9 100644 --- a/src/client/src/tscSub.c +++ b/src/client/src/tscSub.c @@ -301,7 +301,9 @@ void tscSaveSubscriptionProgress(void* sub) { char path[256]; sprintf(path, "%s/subscribe", tsDataDir); if (access(path, 0) != 0) { - mkdir(path, 0777); + if (mkdir(path, 0777) != 0 && errno != EEXIST) { + tscError("failed to create subscribe dir: %s", path); + } } sprintf(path, "%s/subscribe/%s", tsDataDir, pSub->topic); diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index 75249e44eefd86f1e8ff1cc30e230ed01c5fcac4..d3c8eefbb9c37d85f1cf72a361f5ff72c9bb93d9 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -80,9 +80,8 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { } void taos_init_imp() { - char temp[128]; - struct stat dirstat; - + char temp[128]; + errno = TSDB_CODE_SUCCESS; srand(taosGetTimestampSec()); deltaToUtcInitOnce(); @@ -94,7 +93,9 @@ void taos_init_imp() { taosReadGlobalLogCfg(); // For log directory - if (stat(tsLogDir, &dirstat) < 0) mkdir(tsLogDir, 0755); + if (mkdir(tsLogDir, 0755) != 0 && errno != EEXIST) { + printf("failed to create log dir:%s\n", tsLogDir); + } sprintf(temp, "%s/taoslog", tsLogDir); if (taosInitLog(temp, tsNumOfLogLines, 10) < 0) {