diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c index 600ef8834407360a814767a0633720327fcd697c..5ae226a577a9af982c7c0d926eb432d5e7e73ac4 100644 --- a/src/client/src/tscLocal.c +++ b/src/client/src/tscLocal.c @@ -156,7 +156,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(output, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(output, src, strlen(src)); } } @@ -191,7 +192,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { // tag value pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; - STR_WITH_SIZE_TO_VARSTR(target, "TAG", 3); + const char *src = "TAG"; + STR_WITH_SIZE_TO_VARSTR(target, src, strlen(src)); pTagValue += pSchema[i].bytes; } diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 12032725c388bb5fedd72347d6cd1fa4feaf8831..b33220fb81c628ec6d9c5919a28241b2b64cdb20 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -2222,14 +2222,14 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { char* portStr = strtok(NULL, &delim); if (!validateIpAddress(ipStr, strlen(ipStr))) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); } uint16_t port = (uint16_t)strtol(portStr, NULL, 10); if (port <= 0 || port > 65535) { - memset(pCmd->payload, 0, tListLen(pCmd->payload)); + memset(pCmd->payload, 0, strlen(pCmd->payload)); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); } diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c index 937c8d177dc73138e626f83b18657cbb8eb485a2..33b76cea2deaa8b54d844b0002fbf648d1822599 100644 --- a/src/kit/taosdemo/taosdemo.c +++ b/src/kit/taosdemo/taosdemo.c @@ -634,7 +634,7 @@ void *readMetric(void *sarg) { fprintf(fp, "Querying On %d records:\n", totalData); for (int j = 0; j < n; j++) { - char condition[BUFFER_SIZE] = "\0"; + char condition[BUFFER_SIZE - 30] = "\0"; char tempS[BUFFER_SIZE] = "\0"; int m = 10 < num_of_tables ? 10 : num_of_tables; diff --git a/src/mnode/src/mgmtDb.c b/src/mnode/src/mgmtDb.c index 9eb8b8dce197b603d6f73b0b9c04afbae2392e44..4fd3df17757932c0fe958305b17455e4dd664ac9 100644 --- a/src/mnode/src/mgmtDb.c +++ b/src/mnode/src/mgmtDb.c @@ -677,9 +677,11 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pDb->status == TSDB_DB_STATUS_READY) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "ready", 5); + const char *src = "ready"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "dropping", 8); + const char *src = "dropping"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; diff --git a/src/mnode/src/mgmtDnode.c b/src/mnode/src/mgmtDnode.c index bb98e1c3e6d8ef43fa0bc3ace647b70f6dd02f83..9bb48b7e9520219ffcd1c3f6666cc4e0cfb566fa 100644 --- a/src/mnode/src/mgmtDnode.c +++ b/src/mnode/src/mgmtDnode.c @@ -225,7 +225,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { if (pCmCfgDnode->ep[0] == 0) { strcpy(pCmCfgDnode->ep, tsLocalEp); } else { - strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); + // TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); } if (strcmp(pMsg->pUser->user, "root") != 0) { diff --git a/src/mnode/src/mgmtUser.c b/src/mnode/src/mgmtUser.c index b4dd58cb3b5d7a9c41766de2c039c7f09ea4d39a..1dd572ed9d879e1a399214af3942e01610cef45e 100644 --- a/src/mnode/src/mgmtUser.c +++ b/src/mnode/src/mgmtUser.c @@ -309,11 +309,14 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; if (pUser->superAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "super", 5); + const char *src = "super"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else if (pUser->writeAuth) { - STR_WITH_SIZE_TO_VARSTR(pWrite, "writable", 8); + const char *src = "writable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } else { - STR_WITH_SIZE_TO_VARSTR(pWrite, "readable", 8); + const char *src = "readable"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); } cols++; @@ -525,4 +528,4 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { } mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); -} \ No newline at end of file +} diff --git a/src/mnode/src/mgmtVgroup.c b/src/mnode/src/mgmtVgroup.c index f83268e760ab85e07c22249bff28db6430e598c5..e6fad58b71238518f6bf81bbeaa59a996f2e07e2 100644 --- a/src/mnode/src/mgmtVgroup.c +++ b/src/mnode/src/mgmtVgroup.c @@ -495,11 +495,12 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo cols++; } else { pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + const char *src = "NULL"; + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - STR_WITH_SIZE_TO_VARSTR(pWrite, "NULL", 4); + STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src)); cols++; } } diff --git a/src/os/linux/CMakeLists.txt b/src/os/linux/CMakeLists.txt index 83d717f905fb4cfa40ba357c46c6740ba1f3f636..7be4a13f255d0e72b3ad7462edb5424cdf3762ec 100644 --- a/src/os/linux/CMakeLists.txt +++ b/src/os/linux/CMakeLists.txt @@ -12,3 +12,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ADD_LIBRARY(os ${SRC}) TARGET_LINK_LIBRARIES(os m rt) ENDIF () + +SET_SOURCE_FILES_PROPERTIES(src/linuxSysPara.c PROPERTIES COMPILE_FLAGS -w) diff --git a/src/os/linux/inc/os.h b/src/os/linux/inc/os.h index 27a8363050a2519248ce515e94185c4a623c0d55..cab899753d654912bc10817d4114bcc931760ddd 100644 --- a/src/os/linux/inc/os.h +++ b/src/os/linux/inc/os.h @@ -23,13 +23,6 @@ extern "C" { #include #include -#ifndef _ALPINE - #include - #include -#else - #include -#endif - #include #include #include @@ -82,6 +75,7 @@ extern "C" { #include #include #include +#include #define taosCloseSocket(x) \ { \ diff --git a/src/os/linux/inc/tsysctl.h b/src/os/linux/inc/tsysctl.h new file mode 100644 index 0000000000000000000000000000000000000000..559d5653ee5f1083595d299c7dc61a99a0a35b46 --- /dev/null +++ b/src/os/linux/inc/tsysctl.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef TDENGINE_TSYSCTL_H +#define TDENGINE_TSYSCTL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _ALPINE + #include + #include +#else + #include +#endif + +#endif diff --git a/src/os/linux/src/linuxSysPara.c b/src/os/linux/src/linuxSysPara.c index f43ed44a4bab19a8db80bc89fbb5074531edc514..55d1e198e119cb1635ed16f1e8a82cee09c0c6e5 100644 --- a/src/os/linux/src/linuxSysPara.c +++ b/src/os/linux/src/linuxSysPara.c @@ -15,6 +15,7 @@ #define _DEFAULT_SOURCE #include "os.h" +#include "tsysctl.h" #include "tconfig.h" #include "tglobal.h" #include "tulog.h" diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index d0d798343a433b93f157ce60671d7c65488dbc75..a93d1bb262da56453939d8151630f142811f2aa7 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -119,7 +119,7 @@ char *simGetVariable(SScript *script, char *varName, int varLen) { int simExecuteExpression(SScript *script, char *exp) { char *op1, *op2, *var1, *var2, *var3, *rest; int op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1; - char t0[512], t1[512], t2[512], t3[512]; + char t0[512], t1[512], t2[512], t3[1024]; int result; rest = paGetToken(exp, &var1, &var1Len); @@ -310,14 +310,15 @@ void simStoreSystemContentResult(SScript *script, char *filename) { bool simExecuteSystemContentCmd(SScript *script, char *option) { char buf[4096] = {0}; + char buf1[4096 + 512] = {0}; char filename[400] = {0}; sprintf(filename, "%s/%s.tmp", tsScriptDir, script->fileName); sprintf(buf, "cd %s; ", tsScriptDir); simVisuallizeOption(script, option, buf + strlen(buf)); - sprintf(buf, "%s > %s 2>/dev/null", buf, filename); + sprintf(buf1, "%s > %s 2>/dev/null", buf, filename); - sprintf(script->system_exit_code, "%d", system(buf)); + sprintf(script->system_exit_code, "%d", system(buf1)); simStoreSystemContentResult(script, filename); script->linePos++;