提交 a5b1ba1b 编写于 作者: sangshuduo's avatar sangshuduo

fix compile error for Ubuntu 20.04

[TD-210]
上级 a83824ec
......@@ -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;
}
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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++;
......
......@@ -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) {
......
......@@ -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
}
......@@ -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++;
}
}
......
......@@ -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)
......@@ -23,13 +23,6 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>
#ifndef _ALPINE
#include <error.h>
#include <sys/sysctl.h>
#else
#include <linux/sysctl.h>
#endif
#include <argp.h>
#include <arpa/inet.h>
#include <assert.h>
......@@ -82,6 +75,7 @@ extern "C" {
#include <fcntl.h>
#include <sys/utsname.h>
#include <sys/resource.h>
#include <error.h>
#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 @@
#define _DEFAULT_SOURCE
#include "os.h"
#include "tsysctl.h"
#include "tconfig.h"
#include "tglobal.h"
#include "tulog.h"
......
......@@ -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++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册