From b03e3a81342ba6381d347817e0e6e988a0e7448b Mon Sep 17 00:00:00 2001 From: xinsheng Ren <285808407@qq.com> Date: Tue, 13 Dec 2022 10:57:48 +0800 Subject: [PATCH] FIX:TS-2258-mac cpuinfo has an extra enter character (#18916) * FIX:TS-2258-mac cpuinfo has an extra enter character * fix:TS-2258_static_check Co-authored-by: facetosea <25808407@qq.com> --- source/os/src/osSysinfo.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 89b84ad395..eb989d6957 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -354,6 +354,10 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { code = 0; done |= 1; } + int endPos = strlen(cpuModel)-1; + if (cpuModel[endPos] == '\n') { + cpuModel[endPos] = '\0'; + } taosCloseCmd(&pCmd); pCmd = taosOpenCmd("sysctl -n machdep.cpu.core_count"); -- GitLab