Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4e4520ee
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4e4520ee
编写于
6月 09, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2197 from taosdata/coverity_scan
Coverity scan
上级
640798ac
da7fd645
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
70 addition
and
33 deletion
+70
-33
src/kit/shell/src/shellEngine.c
src/kit/shell/src/shellEngine.c
+0
-12
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+2
-3
src/plugins/http/src/gcHandle.c
src/plugins/http/src/gcHandle.c
+20
-2
src/plugins/http/src/httpSql.c
src/plugins/http/src/httpSql.c
+1
-1
src/plugins/http/src/restHandle.c
src/plugins/http/src/restHandle.c
+29
-3
src/plugins/http/src/tgHandle.c
src/plugins/http/src/tgHandle.c
+11
-4
src/util/src/tlog.c
src/util/src/tlog.c
+7
-8
未找到文件。
src/kit/shell/src/shellEngine.c
浏览文件 @
4e4520ee
...
...
@@ -727,10 +727,6 @@ void read_history() {
char
f_history
[
TSDB_FILENAME_LEN
];
get_history_path
(
f_history
);
if
(
access
(
f_history
,
R_OK
)
==
-
1
)
{
return
;
}
FILE
*
f
=
fopen
(
f_history
,
"r"
);
if
(
f
==
NULL
)
{
fprintf
(
stderr
,
"Opening file %s
\n
"
,
f_history
);
...
...
@@ -809,14 +805,6 @@ void source_file(TAOS *con, char *fptr) {
return
;
}
if
(
access
(
fname
,
R_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not readable
\n
"
,
fptr
);
wordfree
(
&
full_path
);
free
(
cmd
);
return
;
}
FILE
*
f
=
fopen
(
fname
,
"r"
);
if
(
f
==
NULL
)
{
fprintf
(
stderr
,
"ERROR: failed to open file %s
\n
"
,
fname
);
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
4e4520ee
...
...
@@ -646,10 +646,9 @@ int taosDumpDb(SDbInfo *dbInfo, SDumpArguments *arguments, FILE *fp) {
taosDumpTable
(
tableRecord
.
name
,
tableRecord
.
metric
,
arguments
,
fp
);
}
tclose
(
fd
);
remove
(
".table.tmp"
);
close
(
fd
);
return
0
;
return
remove
(
".table.tmp"
)
;
}
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
SDumpArguments
*
arguments
,
FILE
*
fp
)
{
...
...
src/plugins/http/src/gcHandle.c
浏览文件 @
4e4520ee
...
...
@@ -22,9 +22,27 @@
#include "taosdef.h"
static
HttpDecodeMethod
gcDecodeMethod
=
{
"grafana"
,
gcProcessRequest
};
static
HttpEncodeMethod
gcHeartBeatMethod
=
{
NULL
,
gcSendHeartBeatResp
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
};
static
HttpEncodeMethod
gcHeartBeatMethod
=
{
.
startJsonFp
=
NULL
,
.
stopJsonFp
=
gcSendHeartBeatResp
,
.
buildQueryJsonFp
=
NULL
,
.
buildAffectRowJsonFp
=
NULL
,
.
initJsonFp
=
NULL
,
.
cleanJsonFp
=
NULL
,
.
checkFinishedFp
=
NULL
,
.
setNextCmdFp
=
NULL
};
static
HttpEncodeMethod
gcQueryMethod
=
{
NULL
,
gcStopQueryJson
,
gcBuildQueryJson
,
NULL
,
gcInitQueryJson
,
gcCleanQueryJson
,
NULL
,
NULL
};
.
startJsonFp
=
NULL
,
.
stopJsonFp
=
gcStopQueryJson
,
.
buildQueryJsonFp
=
gcBuildQueryJson
,
.
buildAffectRowJsonFp
=
NULL
,
.
initJsonFp
=
gcInitQueryJson
,
.
cleanJsonFp
=
gcCleanQueryJson
,
.
checkFinishedFp
=
NULL
,
.
setNextCmdFp
=
NULL
};
void
gcInitHandle
(
HttpServer
*
pServer
)
{
httpAddMethod
(
pServer
,
&
gcDecodeMethod
);
}
...
...
src/plugins/http/src/httpSql.c
浏览文件 @
4e4520ee
...
...
@@ -87,7 +87,7 @@ void httpProcessMultiSqlCallBack(void *param, TAOS_RES *result, int code) {
}
if
(
code
<
0
)
{
if
(
encode
->
checkFinishedFp
!=
NULL
&&
!
encode
->
checkFinishedFp
(
pContext
,
singleCmd
,
code
>=
0
?
0
:
code
))
{
if
(
encode
->
checkFinishedFp
!=
NULL
&&
!
encode
->
checkFinishedFp
(
pContext
,
singleCmd
,
-
code
))
{
singleCmd
->
code
=
code
;
httpTrace
(
"context:%p, fd:%d, ip:%s, user:%s, process pos jump to:%d, last code:%s, last sql:%s"
,
pContext
,
pContext
->
fd
,
pContext
->
ipstr
,
pContext
->
user
,
multiCmds
->
pos
+
1
,
tstrerror
(
code
),
sql
);
...
...
src/plugins/http/src/restHandle.c
浏览文件 @
4e4520ee
...
...
@@ -22,11 +22,37 @@
static
HttpDecodeMethod
restDecodeMethod
=
{
"rest"
,
restProcessRequest
};
static
HttpDecodeMethod
restDecodeMethod2
=
{
"restful"
,
restProcessRequest
};
static
HttpEncodeMethod
restEncodeSqlTimestampMethod
=
{
restStartSqlJson
,
restStopSqlJson
,
restBuildSqlTimestampJson
,
restBuildSqlAffectRowsJson
,
NULL
,
NULL
,
NULL
,
NULL
};
.
startJsonFp
=
restStartSqlJson
,
.
stopJsonFp
=
restStopSqlJson
,
.
buildQueryJsonFp
=
restBuildSqlTimestampJson
,
.
buildAffectRowJsonFp
=
restBuildSqlAffectRowsJson
,
.
initJsonFp
=
NULL
,
.
cleanJsonFp
=
NULL
,
.
checkFinishedFp
=
NULL
,
.
setNextCmdFp
=
NULL
};
static
HttpEncodeMethod
restEncodeSqlLocalTimeStringMethod
=
{
restStartSqlJson
,
restStopSqlJson
,
restBuildSqlLocalTimeStringJson
,
restBuildSqlAffectRowsJson
,
NULL
,
NULL
,
NULL
,
NULL
};
.
startJsonFp
=
restStartSqlJson
,
.
stopJsonFp
=
restStopSqlJson
,
.
buildQueryJsonFp
=
restBuildSqlLocalTimeStringJson
,
.
buildAffectRowJsonFp
=
restBuildSqlAffectRowsJson
,
.
initJsonFp
=
NULL
,
.
cleanJsonFp
=
NULL
,
.
checkFinishedFp
=
NULL
,
.
setNextCmdFp
=
NULL
};
static
HttpEncodeMethod
restEncodeSqlUtcTimeStringMethod
=
{
restStartSqlJson
,
restStopSqlJson
,
restBuildSqlUtcTimeStringJson
,
restBuildSqlAffectRowsJson
,
NULL
,
NULL
,
NULL
,
NULL
};
.
startJsonFp
=
restStartSqlJson
,
.
stopJsonFp
=
restStopSqlJson
,
.
buildQueryJsonFp
=
restBuildSqlUtcTimeStringJson
,
.
buildAffectRowJsonFp
=
restBuildSqlAffectRowsJson
,
.
initJsonFp
=
NULL
,
.
cleanJsonFp
=
NULL
,
.
checkFinishedFp
=
NULL
,
.
setNextCmdFp
=
NULL
};
void
restInitHandle
(
HttpServer
*
pServer
)
{
httpAddMethod
(
pServer
,
&
restDecodeMethod
);
...
...
src/plugins/http/src/tgHandle.c
浏览文件 @
4e4520ee
...
...
@@ -62,9 +62,16 @@
#define TG_MAX_SORT_TAG_SIZE 20
static
HttpDecodeMethod
tgDecodeMethod
=
{
"telegraf"
,
tgProcessRquest
};
static
HttpEncodeMethod
tgQueryMethod
=
{
tgStartQueryJson
,
tgStopQueryJson
,
NULL
,
tgBuildSqlAffectRowsJson
,
tgInitQueryJson
,
tgCleanQueryJson
,
tgCheckFinished
,
tgSetNextCmd
};
static
HttpEncodeMethod
tgQueryMethod
=
{
.
startJsonFp
=
tgStartQueryJson
,
.
stopJsonFp
=
tgStopQueryJson
,
.
buildQueryJsonFp
=
NULL
,
.
buildAffectRowJsonFp
=
tgBuildSqlAffectRowsJson
,
.
initJsonFp
=
tgInitQueryJson
,
.
cleanJsonFp
=
tgCleanQueryJson
,
.
checkFinishedFp
=
tgCheckFinished
,
.
setNextCmdFp
=
tgSetNextCmd
};
static
const
char
DEFAULT_TELEGRAF_CFG
[]
=
"{
\"
metrics
\"
:["
...
...
@@ -303,7 +310,7 @@ bool tgGetUserFromUrl(HttpContext *pContext) {
return
false
;
}
strcpy
(
pContext
->
user
,
pParser
->
path
[
TG_USER_URL_POS
].
pos
);
tstrncpy
(
pContext
->
user
,
pParser
->
path
[
TG_USER_URL_POS
].
pos
,
TSDB_USER_LEN
);
return
true
;
}
...
...
src/util/src/tlog.c
浏览文件 @
4e4520ee
...
...
@@ -191,15 +191,14 @@ void taosResetLog() {
}
static
bool
taosCheckFileIsOpen
(
char
*
logFileName
)
{
int32_t
exist
=
access
(
logFileName
,
F_OK
);
if
(
exist
!=
0
)
{
return
false
;
}
int32_t
fd
=
open
(
logFileName
,
O_WRONLY
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
int32_t
fd
=
open
(
logFileName
,
O_WRONLY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
fd
<
0
)
{
printf
(
"
\n
failed to open log file:%s, reason:%s
\n
"
,
logFileName
,
strerror
(
errno
));
return
true
;
if
(
errno
==
ENOENT
)
{
return
false
;
}
else
{
printf
(
"
\n
failed to open log file:%s, reason:%s
\n
"
,
logFileName
,
strerror
(
errno
));
return
true
;
}
}
if
(
taosLockFile
(
fd
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录