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>
This commit is contained in:
xinsheng Ren 2022-12-13 10:57:48 +08:00 committed by GitHub
parent ad4c949f2a
commit b03e3a8134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -354,6 +354,10 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) {
code = 0; code = 0;
done |= 1; done |= 1;
} }
int endPos = strlen(cpuModel)-1;
if (cpuModel[endPos] == '\n') {
cpuModel[endPos] = '\0';
}
taosCloseCmd(&pCmd); taosCloseCmd(&pCmd);
pCmd = taosOpenCmd("sysctl -n machdep.cpu.core_count"); pCmd = taosOpenCmd("sysctl -n machdep.cpu.core_count");