From 79f16a6d5484a69af85919433e173120122dd895 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 19 Oct 2022 17:53:01 +0800 Subject: [PATCH] refact: remove multi process codes --- include/os/osEnv.h | 1 + source/common/src/tglobal.c | 1 + source/dnode/mgmt/exe/dmMain.c | 3 +++ source/dnode/mgmt/node_mgmt/src/dmEnv.c | 2 +- source/os/src/osEnv.c | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/os/osEnv.h b/include/os/osEnv.h index d4e94d6173..c1fdc9e404 100644 --- a/include/os/osEnv.h +++ b/include/os/osEnv.h @@ -60,6 +60,7 @@ bool osTempSpaceSufficient(); void osSetTimezone(const char *timezone); void osSetSystemLocale(const char *inLocale, const char *inCharSet); +void osSetProcPath(int32_t argc, char **argv); #ifdef __cplusplus } diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index c3c14020f3..3edeeee49a 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -1196,6 +1196,7 @@ int32_t taosInitCfg(const char *cfgDir, const char **envCmd, const char *envFile if (cfgLoadFromArray(tsCfg, pArgs) != 0) { uError("failed to load cfg from array since %s", terrstr()); cfgCleanup(tsCfg); + tsCfg = NULL; return -1; } diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index b565cbc318..188677656a 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -208,6 +208,7 @@ int mainWindows(int argc, char **argv) { taosCleanupCfg(); taosCloseLog(); taosCleanupArgs(); + taosConvDestroy(); return 0; } @@ -216,9 +217,11 @@ int mainWindows(int argc, char **argv) { taosCleanupCfg(); taosCloseLog(); taosCleanupArgs(); + taosConvDestroy(); return 0; } + osSetProcPath(argc, (char **)argv); taosCleanupArgs(); if (dmInit() != 0) { diff --git a/source/dnode/mgmt/node_mgmt/src/dmEnv.c b/source/dnode/mgmt/node_mgmt/src/dmEnv.c index 9e32ebcbd7..a222ad3f7d 100644 --- a/source/dnode/mgmt/node_mgmt/src/dmEnv.c +++ b/source/dnode/mgmt/node_mgmt/src/dmEnv.c @@ -132,8 +132,8 @@ void dmCleanup() { taosStopCacheRefreshWorker(); dInfo("dnode env is cleaned up"); - taosCloseLog(); taosCleanupCfg(); + taosCloseLog(); } void dmStop() { diff --git a/source/os/src/osEnv.c b/source/os/src/osEnv.c index 616ab7875d..ac1881fc6d 100644 --- a/source/os/src/osEnv.c +++ b/source/os/src/osEnv.c @@ -105,3 +105,5 @@ void osSetSystemLocale(const char *inLocale, const char *inCharSet) { memcpy(tsLocale, inLocale, strlen(inLocale) + 1); memcpy(tsCharset, inCharSet, strlen(inCharSet) + 1); } + +void osSetProcPath(int32_t argc, char **argv) { tsProcPath = argv[0]; } -- GitLab