Merge pull request #24575 from taosdata/fix/TD-28356

fix: err in create log should not be ignored
This commit is contained in:
Hongze Cheng 2024-02-19 10:21:31 +08:00 committed by GitHub
commit 31b8410c33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 6 deletions

View File

@ -681,8 +681,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) {
@ -750,8 +751,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

@ -28,7 +28,7 @@ void shellCrashHandler(int signum, void *sigInfo, void *context) {
#if !defined(WINDOWS)
taosIgnSignal(SIGBUS);
#endif
#endif
taosIgnSignal(SIGABRT);
taosIgnSignal(SIGFPE);
taosIgnSignal(SIGSEGV);
@ -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);
@ -105,7 +107,7 @@ int main(int argc, char *argv[]) {
return 0;
}
// support port feature
// support port feature
shellAutoInit();
int32_t ret = shellExecute();
shellAutoExit();