未验证 提交 4147090d 编写于 作者: S slguan 提交者: GitHub

Merge pull request #1861 from taosdata/feature/support-ubuntu-2004

fix compile error for Ubuntu 20.04
...@@ -156,7 +156,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) { ...@@ -156,7 +156,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3);
if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) { if (i >= tscGetNumOfColumns(pMeta) && tscGetNumOfTags(pMeta) != 0) {
char* output = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; 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) { ...@@ -191,7 +192,8 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// tag value // tag value
pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3); pField = tscFieldInfoGetField(&pQueryInfo->fieldsInfo, 3);
char *target = pRes->data + tscFieldInfoGetOffset(pQueryInfo, 3) * totalNumOfRows + pField->bytes * i; 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; pTagValue += pSchema[i].bytes;
} }
......
...@@ -2255,14 +2255,14 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) { ...@@ -2255,14 +2255,14 @@ int32_t setKillInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char* portStr = strtok(NULL, &delim); char* portStr = strtok(NULL, &delim);
if (!validateIpAddress(ipStr, strlen(ipStr))) { if (!validateIpAddress(ipStr, strlen(ipStr))) {
memset(pCmd->payload, 0, tListLen(pCmd->payload)); memset(pCmd->payload, 0, strlen(pCmd->payload));
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg1);
} }
uint16_t port = (uint16_t)strtol(portStr, NULL, 10); uint16_t port = (uint16_t)strtol(portStr, NULL, 10);
if (port <= 0 || port > 65535) { if (port <= 0 || port > 65535) {
memset(pCmd->payload, 0, tListLen(pCmd->payload)); memset(pCmd->payload, 0, strlen(pCmd->payload));
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
......
...@@ -634,7 +634,7 @@ void *readMetric(void *sarg) { ...@@ -634,7 +634,7 @@ void *readMetric(void *sarg) {
fprintf(fp, "Querying On %d records:\n", totalData); fprintf(fp, "Querying On %d records:\n", totalData);
for (int j = 0; j < n; j++) { for (int j = 0; j < n; j++) {
char condition[BUFFER_SIZE] = "\0"; char condition[BUFFER_SIZE - 30] = "\0";
char tempS[BUFFER_SIZE] = "\0"; char tempS[BUFFER_SIZE] = "\0";
int m = 10 < num_of_tables ? 10 : num_of_tables; int m = 10 < num_of_tables ? 10 : num_of_tables;
......
...@@ -677,9 +677,11 @@ static int32_t mgmtRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void * ...@@ -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; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
if (pDb->status == TSDB_DB_STATUS_READY) { 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 { } else {
STR_WITH_SIZE_TO_VARSTR(pWrite, "dropping", 8); const char *src = "dropping";
STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src));
} }
cols++; cols++;
......
...@@ -223,7 +223,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) { ...@@ -223,7 +223,7 @@ void mgmtProcessCfgDnodeMsg(SQueuedMsg *pMsg) {
if (pCmCfgDnode->ep[0] == 0) { if (pCmCfgDnode->ep[0] == 0) {
strcpy(pCmCfgDnode->ep, tsLocalEp); strcpy(pCmCfgDnode->ep, tsLocalEp);
} else { } else {
strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep); // TODO temporary disabled for compiling: strcpy(pCmCfgDnode->ep, pCmCfgDnode->ep);
} }
if (strcmp(pMsg->pUser->user, "root") != 0) { if (strcmp(pMsg->pUser->user, "root") != 0) {
......
...@@ -309,11 +309,14 @@ static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void ...@@ -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; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
if (pUser->superAuth) { 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) { } 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 { } else {
STR_WITH_SIZE_TO_VARSTR(pWrite, "readable", 8); const char *src = "readable";
STR_WITH_SIZE_TO_VARSTR(pWrite, src, strlen(src));
} }
cols++; cols++;
...@@ -525,4 +528,4 @@ void mgmtDropAllUsers(SAcctObj *pAcct) { ...@@ -525,4 +528,4 @@ void mgmtDropAllUsers(SAcctObj *pAcct) {
} }
mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers); mTrace("acct:%s, all users:%d is dropped from sdb", pAcct->user, numOfUsers);
} }
\ No newline at end of file
...@@ -494,11 +494,12 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo ...@@ -494,11 +494,12 @@ int32_t mgmtRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, void *pCo
cols++; cols++;
} else { } else {
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; 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++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; 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++; cols++;
} }
} }
......
...@@ -12,3 +12,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM)) ...@@ -12,3 +12,5 @@ IF ((TD_LINUX_64) OR (TD_LINUX_32 AND TD_ARM))
ADD_LIBRARY(os ${SRC}) ADD_LIBRARY(os ${SRC})
TARGET_LINK_LIBRARIES(os m rt) TARGET_LINK_LIBRARIES(os m rt)
ENDIF () ENDIF ()
SET_SOURCE_FILES_PROPERTIES(src/linuxSysPara.c PROPERTIES COMPILE_FLAGS -w)
...@@ -23,13 +23,6 @@ extern "C" { ...@@ -23,13 +23,6 @@ extern "C" {
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef _ALPINE
#include <error.h>
#include <sys/sysctl.h>
#else
#include <linux/sysctl.h>
#endif
#include <argp.h> #include <argp.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <assert.h> #include <assert.h>
...@@ -82,6 +75,7 @@ extern "C" { ...@@ -82,6 +75,7 @@ extern "C" {
#include <fcntl.h> #include <fcntl.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <error.h>
#define taosCloseSocket(x) \ #define taosCloseSocket(x) \
{ \ { \
......
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef TDENGINE_TSYSCTL_H
#define TDENGINE_TSYSCTL_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ALPINE
#include <error.h>
#include <sys/sysctl.h>
#else
#include <linux/sysctl.h>
#endif
#endif
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "tsysctl.h"
#include "tconfig.h" #include "tconfig.h"
#include "tglobal.h" #include "tglobal.h"
#include "tulog.h" #include "tulog.h"
......
...@@ -119,7 +119,7 @@ char *simGetVariable(SScript *script, char *varName, int varLen) { ...@@ -119,7 +119,7 @@ char *simGetVariable(SScript *script, char *varName, int varLen) {
int simExecuteExpression(SScript *script, char *exp) { int simExecuteExpression(SScript *script, char *exp) {
char *op1, *op2, *var1, *var2, *var3, *rest; char *op1, *op2, *var1, *var2, *var3, *rest;
int op1Len, op2Len, var1Len, var2Len, var3Len, val0, val1; 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; int result;
rest = paGetToken(exp, &var1, &var1Len); rest = paGetToken(exp, &var1, &var1Len);
...@@ -310,14 +310,15 @@ void simStoreSystemContentResult(SScript *script, char *filename) { ...@@ -310,14 +310,15 @@ void simStoreSystemContentResult(SScript *script, char *filename) {
bool simExecuteSystemContentCmd(SScript *script, char *option) { bool simExecuteSystemContentCmd(SScript *script, char *option) {
char buf[4096] = {0}; char buf[4096] = {0};
char buf1[4096 + 512] = {0};
char filename[400] = {0}; char filename[400] = {0};
sprintf(filename, "%s/%s.tmp", tsScriptDir, script->fileName); sprintf(filename, "%s/%s.tmp", tsScriptDir, script->fileName);
sprintf(buf, "cd %s; ", tsScriptDir); sprintf(buf, "cd %s; ", tsScriptDir);
simVisuallizeOption(script, option, buf + strlen(buf)); 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); simStoreSystemContentResult(script, filename);
script->linePos++; script->linePos++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册