diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 491a49778c..d40b1abb6a 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -933,7 +933,7 @@ void taos_init_imp(void) { appInfo.pInstMapByClusterId = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BIGINT), true, HASH_ENTRY_LOCK); if (NULL == appInfo.pInstMap || NULL == appInfo.pInstMapByClusterId) { - tscError("failed to allocate memory when init appInfo"); + (void)printf("failed to allocate memory when init appInfo\n"); tscInitRes = TSDB_CODE_OUT_OF_MEMORY; return; } @@ -961,7 +961,7 @@ void taos_init_imp(void) { if (InitRegexCache() != 0) { tscInitRes = -1; - tscError("failed to init regex cache"); + (void)printf("failed to init regex cache\n"); return; } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index f44c0b0b51..554f9f52af 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -485,27 +485,27 @@ static int32_t taosLoadCfg(SConfig *pCfg, const char **envCmd, const char *input } if ((code = cfgLoad(pCfg, CFG_STYPE_APOLLO_URL, apolloUrl)) != 0) { - printf("failed to load from apollo url:%s since %s\n", apolloUrl, tstrerror(code)); + (void)printf("failed to load from apollo url:%s since %s\n", apolloUrl, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_CFG_FILE, cfgFile)) != 0) { - printf("failed to load from cfg file:%s since %s\n", cfgFile, tstrerror(code)); + (void)printf("failed to load from cfg file:%s since %s\n", cfgFile, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_FILE, envFile)) != 0) { - printf("failed to load from env file:%s since %s\n", envFile, tstrerror(code)); + (void)printf("failed to load from env file:%s since %s\n", envFile, tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_VAR, NULL)) != 0) { - printf("failed to load from global env variables since %s\n", tstrerror(code)); + (void)printf("failed to load from global env variables since %s\n", tstrerror(code)); TAOS_RETURN(code); } if ((code = cfgLoad(pCfg, CFG_STYPE_ENV_CMD, envCmd)) != 0) { - printf("failed to load from cmd env variables since %s\n", tstrerror(code)); + (void)printf("failed to load from cmd env variables since %s\n", tstrerror(code)); TAOS_RETURN(code); } @@ -1648,12 +1648,12 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi } if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != TSDB_CODE_SUCCESS) { - printf("failed to load cfg since %s\n", tstrerror(code)); + (void)printf("failed to load cfg since %s\n", tstrerror(code)); goto _exit; } if ((code = cfgLoadFromArray(pCfg, pArgs)) != TSDB_CODE_SUCCESS) { - printf("failed to load cfg from array since %s\n", tstrerror(code)); + (void)printf("failed to load cfg from array since %s\n", tstrerror(code)); goto _exit; } @@ -1669,18 +1669,18 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi TAOS_CHECK_GOTO(taosSetAllDebugFlag(pCfg, pDebugItem->i32), &lino, _exit); if ((code = taosMulModeMkDir(tsLogDir, 0777, true)) != TSDB_CODE_SUCCESS) { - printf("failed to create dir:%s since %s\n", tsLogDir, tstrerror(code)); + (void)printf("failed to create dir:%s since %s\n", tsLogDir, tstrerror(code)); goto _exit; } if ((code = taosInitLog(logname, logFileNum, tsc)) != 0) { - printf("failed to init log file since %s\n", tstrerror(code)); + (void)printf("failed to init log file since %s\n", tstrerror(code)); goto _exit; } _exit: if (TSDB_CODE_SUCCESS != code) { - printf("failed to create log at %d since %s:", lino, tstrerror(code)); + (void)printf("failed to create log at %d since %s:", lino, tstrerror(code)); } cfgCleanup(pCfg); @@ -1700,12 +1700,12 @@ int32_t taosReadDataFolder(const char *cfgDir, const char **envCmd, const char * TAOS_CHECK_GOTO(cfgAddInt32(pCfg, "dDebugFlag", dDebugFlag, 0, 255, CFG_SCOPE_SERVER, CFG_DYN_SERVER) ,NULL, _exit); if ((code = taosLoadCfg(pCfg, envCmd, cfgDir, envFile, apolloUrl)) != 0) { - printf("failed to load cfg since %s\n", tstrerror(code)); + (void)printf("failed to load cfg since %s\n", tstrerror(code)); goto _exit; } if ((code = cfgLoadFromArray(pCfg, pArgs)) != 0) { - printf("failed to load cfg from array since %s\n", tstrerror(code)); + (void)printf("failed to load cfg from array since %s\n", tstrerror(code)); goto _exit; } diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index 0ff2cf4eae..82bc8da2d5 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -994,7 +994,7 @@ int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *envFile) { const char *filepath = ".env"; if (envFile != NULL && strlen(envFile) > 0) { if (!taosCheckExistFile(envFile)) { - printf("failed to load env file:%s\n", envFile); + (void)printf("failed to load env file:%s\n", envFile); TAOS_RETURN(TSDB_CODE_NOT_FOUND); } filepath = envFile; @@ -1069,7 +1069,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { uInfo("failed to load from cfg file %s since %s, use default parameters", filepath, tstrerror(code)); TAOS_RETURN(TSDB_CODE_SUCCESS); } else { - printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); + (void)printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); TAOS_RETURN(code); } } @@ -1112,7 +1112,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { code = cfgSetItem(pConfig, name, newValue, CFG_STYPE_CFG_FILE, true); if (code != 0){ - printf("cfg:%s, value:%s failed since %s\n", name,newValue, tstrerror(code)); + (void)printf("cfg:%s, value:%s failed since %s\n", name,newValue, tstrerror(code)); } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) break; } else { @@ -1129,7 +1129,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { code = cfgSetItem(pConfig, name, value, CFG_STYPE_CFG_FILE, true); if (code != 0){ - printf("cfg:%s, value:%s failed since %s\n", name, value, tstrerror(code)); + (void)printf("cfg:%s, value:%s failed since %s\n", name, value, tstrerror(code)); } if (TSDB_CODE_SUCCESS != code && TSDB_CODE_CFG_NOT_FOUND != code) break; } @@ -1154,7 +1154,7 @@ int32_t cfgLoadFromCfgFile(SConfig *pConfig, const char *filepath) { uInfo("load from cfg file %s success", filepath); TAOS_RETURN(TSDB_CODE_SUCCESS); } else { - printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); + (void)printf("failed to load from cfg file %s since %s\n", filepath, tstrerror(code)); TAOS_RETURN(code); } } @@ -1236,7 +1236,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { char *p = strchr(url, ':'); if (p == NULL) { - printf("fail to load apoll url: %s, unknown format\n", url); + (void)printf("fail to load apoll url: %s, unknown format\n", url); TAOS_RETURN(TSDB_CODE_INVALID_PARA); } p++; @@ -1244,7 +1244,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { if (strncmp(url, "jsonFile", 8) == 0) { char *filepath = p; if (!taosCheckExistFile(filepath)) { - printf("failed to load json file:%s\n", filepath); + (void)printf("failed to load json file:%s\n", filepath); TAOS_RETURN(TSDB_CODE_NOT_FOUND); } @@ -1256,7 +1256,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { char *buf = taosMemoryMalloc(fileSize + 1); if (!buf) { (void)taosCloseFile(&pFile); - printf("load json file error: %s, failed to alloc memory\n", filepath); + (void)printf("load json file error: %s, failed to alloc memory\n", filepath); TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); } @@ -1264,7 +1264,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { (void)taosLSeekFile(pFile, 0, SEEK_SET); if (taosReadFile(pFile, buf, fileSize) <= 0) { (void)taosCloseFile(&pFile); - printf("load json file error: %s\n", filepath); + (void)printf("load json file error: %s\n", filepath); taosMemoryFreeClear(buf); TAOS_RETURN(TSDB_CODE_INVALID_DATA_FMT); } @@ -1273,7 +1273,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { if (NULL == pJson) { const char *jsonParseError = tjsonGetError(); if (jsonParseError != NULL) { - printf("load json file parse error: %s\n", jsonParseError); + (void)printf("load json file parse error: %s\n", jsonParseError); } taosMemoryFreeClear(buf); TAOS_CHECK_EXIT(TSDB_CODE_INVALID_DATA_FMT); @@ -1341,7 +1341,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { // } else if (strncmp(url, "jsonUrl", 7) == 0) { // } else if (strncmp(url, "etcdUrl", 7) == 0) { } else { - printf("Unsupported url: %s\n", url); + (void)printf("Unsupported url: %s\n", url); TAOS_RETURN(TSDB_CODE_INVALID_PARA); } @@ -1353,7 +1353,7 @@ _exit: taosMemoryFree(cfgLineBuf); tjsonDelete(pJson); if (code != 0) { - printf("failed to load from apollo url:%s at line %d since %s\n", url, lino, tstrerror(code)); + (void)printf("failed to load from apollo url:%s at line %d since %s\n", url, lino, tstrerror(code)); } TAOS_RETURN(code); } diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index 3c41e00b7a..49e1d87d80 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -206,7 +206,7 @@ int32_t taosInitSlowLog() { (void)taosUmaskFile(0); tsLogObj.slowHandle->pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_APPEND); if (tsLogObj.slowHandle->pFile == NULL) { - printf("\nfailed to open slow log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to open slow log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } @@ -529,7 +529,7 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { processLogFileName(logName, maxFileNum); char name[PATH_MAX + 50] = "\0"; - sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag); + (void)sprintf(name, "%s.%d", tsLogObj.logName, tsLogObj.flag); (void)taosThreadMutexInit(&tsLogObj.logMutex, NULL); (void)taosUmaskFile(0); @@ -538,7 +538,7 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { tsLogObj.logHandle->pFile = taosOpenFile(name, TD_FILE_CREATE | TD_FILE_WRITE); if (tsLogObj.logHandle->pFile == NULL) { - printf("\nfailed to open log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to open log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } (void)taosLockLogFile(tsLogObj.logHandle->pFile); @@ -546,18 +546,18 @@ static int32_t taosInitNormalLog(const char *logName, int32_t maxFileNum) { // only an estimate for number of lines int64_t filesize = 0; if (taosFStatFile(tsLogObj.logHandle->pFile, &filesize, NULL) < 0) { - printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno)); + (void)printf("\nfailed to fstat log file:%s, reason:%s\n", name, strerror(errno)); return TAOS_SYSTEM_ERROR(errno); } tsLogObj.lines = (int32_t)(filesize / 60); (void)taosLSeekFile(tsLogObj.logHandle->pFile, 0, SEEK_END); - sprintf(name, "==================================================\n"); + (void)sprintf(name, "==================================================\n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); - sprintf(name, " new log file \n"); + (void)sprintf(name, " new log file \n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); - sprintf(name, "==================================================\n"); + (void)sprintf(name, "==================================================\n"); (void)taosWriteFile(tsLogObj.logHandle->pFile, name, (uint32_t)strlen(name)); return 0;