提交 628bb019 编写于 作者: S Shengliang Guan

[TD_543] fix coverity scan, cid:267787

上级 422e45bd
...@@ -301,7 +301,9 @@ void tscSaveSubscriptionProgress(void* sub) { ...@@ -301,7 +301,9 @@ void tscSaveSubscriptionProgress(void* sub) {
char path[256]; char path[256];
sprintf(path, "%s/subscribe", tsDataDir); sprintf(path, "%s/subscribe", tsDataDir);
if (access(path, 0) != 0) { 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); sprintf(path, "%s/subscribe/%s", tsDataDir, pSub->topic);
......
...@@ -80,9 +80,8 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { ...@@ -80,9 +80,8 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
} }
void taos_init_imp() { void taos_init_imp() {
char temp[128]; char temp[128];
struct stat dirstat;
errno = TSDB_CODE_SUCCESS; errno = TSDB_CODE_SUCCESS;
srand(taosGetTimestampSec()); srand(taosGetTimestampSec());
deltaToUtcInitOnce(); deltaToUtcInitOnce();
...@@ -94,7 +93,9 @@ void taos_init_imp() { ...@@ -94,7 +93,9 @@ void taos_init_imp() {
taosReadGlobalLogCfg(); taosReadGlobalLogCfg();
// For log directory // 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); sprintf(temp, "%s/taoslog", tsLogDir);
if (taosInitLog(temp, tsNumOfLogLines, 10) < 0) { if (taosInitLog(temp, tsNumOfLogLines, 10) < 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册