fix: err in create log should not be ignored

This commit is contained in:
Shungang Li 2024-01-22 11:10:00 +08:00
parent 567aab933d
commit c719027b0b
2 changed files with 12 additions and 6 deletions

View File

@ -680,8 +680,9 @@ void taos_init_imp(void) {
snprintf(logDirName, 64, "taoslog");
#endif
if (taosCreateLog(logDirName, 10, configDir, NULL, NULL, NULL, NULL, 1) != 0) {
// ignore create log failed, only print
printf(" WARING: Create %s failed:%s. configDir=%s\n", logDirName, strerror(errno), configDir);
tscInitRes = -1;
return;
}
if (taosInitCfg(configDir, NULL, NULL, NULL, NULL, 1) != 0) {
@ -749,8 +750,11 @@ int taos_options_imp(TSDB_OPTION option, const char *str) {
tstrncpy(configDir, str, PATH_MAX);
tscInfo("set cfg:%s to %s", configDir, str);
return 0;
} else {
taos_init(); // initialize global config
}
// initialize global config
if (taos_init() != 0) {
return -1;
}
SConfig *pCfg = taosGetCfg();

View File

@ -82,7 +82,9 @@ int main(int argc, char *argv[]) {
#ifdef WEBSOCKET
shellCheckConnectMode();
#endif
taos_init();
if (taos_init() != 0) {
return -1;
}
// kill heart-beat thread when quit
taos_set_hb_quit(1);