Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
02436e6d
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
02436e6d
编写于
6月 22, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[modify for covrity scan]
上级
3c1850ac
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
30 deletion
+39
-30
src/kit/shell/src/shellLinux.c
src/kit/shell/src/shellLinux.c
+9
-9
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+4
-4
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+15
-12
src/os/linux/src/linuxSysPara.c
src/os/linux/src/linuxSysPara.c
+9
-3
src/util/src/tlog.c
src/util/src/tlog.c
+1
-1
src/util/src/tnote.c
src/util/src/tnote.c
+1
-1
未找到文件。
src/kit/shell/src/shellLinux.c
浏览文件 @
02436e6d
...
...
@@ -168,7 +168,7 @@ void shellReadCommand(TAOS *con, char *command) {
int
count
=
countPrefixOnes
(
c
);
utf8_array
[
0
]
=
c
;
for
(
int
k
=
1
;
k
<
count
;
k
++
)
{
c
=
getchar
();
c
=
(
char
)
getchar
();
utf8_array
[
k
]
=
c
;
}
insertChar
(
&
cmd
,
utf8_array
,
count
);
...
...
@@ -214,10 +214,10 @@ void shellReadCommand(TAOS *con, char *command) {
break
;
}
}
else
if
(
c
==
'\033'
)
{
c
=
getchar
();
c
=
(
char
)
getchar
();
switch
(
c
)
{
case
'['
:
c
=
getchar
();
c
=
(
char
)
getchar
();
switch
(
c
)
{
case
'A'
:
// Up arrow
if
(
hist_counter
!=
history
.
hstart
)
{
...
...
@@ -244,35 +244,35 @@ void shellReadCommand(TAOS *con, char *command) {
moveCursorLeft
(
&
cmd
);
break
;
case
'1'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// Home key
positionCursorHome
(
&
cmd
);
}
break
;
case
'2'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// Insert key
}
break
;
case
'3'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// Delete key
deleteChar
(
&
cmd
);
}
break
;
case
'4'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// End key
positionCursorEnd
(
&
cmd
);
}
break
;
case
'5'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// Page up key
}
break
;
case
'6'
:
if
((
c
=
getchar
())
==
'~'
)
{
if
((
c
=
(
char
)
getchar
())
==
'~'
)
{
// Page down key
}
break
;
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
02436e6d
...
...
@@ -551,8 +551,8 @@ int main(int argc, char *argv[]) {
for
(
int
i
=
0
;
i
<
threads
;
i
++
)
{
info
*
t_info
=
infos
+
i
;
t_info
->
threadID
=
i
;
strcpy
(
t_info
->
db_name
,
db_name
);
strcpy
(
t_info
->
tb_prefix
,
tb_prefix
);
tstrncpy
(
t_info
->
db_name
,
db_name
,
MAX_DB_NAME_SIZE
);
tstrncpy
(
t_info
->
tb_prefix
,
tb_prefix
,
MAX_TB_NAME_SIZE
);
t_info
->
datatype
=
data_type
;
t_info
->
ncols_per_record
=
ncols_per_record
;
t_info
->
nrecords_per_table
=
nrecords_per_table
;
...
...
@@ -1001,9 +1001,9 @@ int32_t generateData(char *res, char **data_type, int num_of_cols, int64_t times
}
else
if
(
strcasecmp
(
data_type
[
i
%
c
],
"bigint"
)
==
0
)
{
pstr
+=
sprintf
(
pstr
,
", %"
PRId64
,
trand
()
%
2147483648
);
}
else
if
(
strcasecmp
(
data_type
[
i
%
c
],
"float"
)
==
0
)
{
pstr
+=
sprintf
(
pstr
,
", %10.4f"
,
(
float
)(
trand
()
/
1000
));
pstr
+=
sprintf
(
pstr
,
", %10.4f"
,
(
float
)(
trand
()
/
1000
.
0
));
}
else
if
(
strcasecmp
(
data_type
[
i
%
c
],
"double"
)
==
0
)
{
double
t
=
(
double
)(
trand
()
/
1000000
);
double
t
=
(
double
)(
trand
()
/
1000000
.
0
);
pstr
+=
sprintf
(
pstr
,
", %20.8f"
,
t
);
}
else
if
(
strcasecmp
(
data_type
[
i
%
c
],
"bool"
)
==
0
)
{
bool
b
=
trand
()
&
1
;
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
02436e6d
...
...
@@ -238,7 +238,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
fprintf
(
stderr
,
"Invalid path %s
\n
"
,
arg
);
return
-
1
;
}
strcpy
(
arguments
->
input
,
full_path
.
we_wordv
[
0
]
);
tstrncpy
(
arguments
->
input
,
full_path
.
we_wordv
[
0
],
TSDB_FILENAME_LEN
);
wordfree
(
&
full_path
);
break
;
case
'c'
:
...
...
@@ -246,7 +246,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
fprintf
(
stderr
,
"Invalid path %s
\n
"
,
arg
);
return
-
1
;
}
strcpy
(
configDir
,
full_path
.
we_wordv
[
0
]
);
tstrncpy
(
configDir
,
full_path
.
we_wordv
[
0
],
TSDB_FILENAME_LEN
);
wordfree
(
&
full_path
);
break
;
case
'e'
:
...
...
@@ -537,11 +537,11 @@ int taosDumpOut(SDumpArguments *arguments) {
if
(
arguments
->
databases
||
arguments
->
all_databases
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
taosDumpDb
(
dbInfos
[
i
],
arguments
,
fp
);
(
void
)
taosDumpDb
(
dbInfos
[
i
],
arguments
,
fp
);
}
}
else
{
if
(
arguments
->
arg_list_len
==
1
)
{
taosDumpDb
(
dbInfos
[
0
],
arguments
,
fp
);
(
void
)
taosDumpDb
(
dbInfos
[
0
],
arguments
,
fp
);
}
else
{
taosDumpCreateDbClause
(
dbInfos
[
0
],
arguments
->
with_property
,
fp
);
...
...
@@ -560,9 +560,9 @@ int taosDumpOut(SDumpArguments *arguments) {
}
if
(
tableRecordInfo
.
isMetric
)
{
// dump whole metric
taosDumpMetric
(
tableRecordInfo
.
tableRecord
.
metric
,
arguments
,
fp
);
(
void
)
taosDumpMetric
(
tableRecordInfo
.
tableRecord
.
metric
,
arguments
,
fp
);
}
else
{
// dump MTable and NTable
taosDumpTable
(
tableRecordInfo
.
tableRecord
.
name
,
tableRecordInfo
.
tableRecord
.
metric
,
arguments
,
fp
);
(
void
)
taosDumpTable
(
tableRecordInfo
.
tableRecord
.
name
,
tableRecordInfo
.
tableRecord
.
metric
,
arguments
,
fp
);
}
}
}
...
...
@@ -645,6 +645,7 @@ int taosDumpDb(SDbInfo *dbInfo, SDumpArguments *arguments, FILE *fp) {
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
while
(
1
)
{
memset
(
&
tableRecord
,
0
,
sizeof
(
STableRecord
));
ssize_t
ret
=
read
(
fd
,
&
tableRecord
,
sizeof
(
STableRecord
));
if
(
ret
<=
0
)
break
;
...
...
@@ -654,8 +655,9 @@ int taosDumpDb(SDbInfo *dbInfo, SDumpArguments *arguments, FILE *fp) {
}
close
(
fd
);
remove
(
".table.tmp"
);
return
remove
(
".table.tmp"
)
;
return
0
;
}
void
taosDumpCreateTableClause
(
STableDef
*
tableDes
,
int
numOfCols
,
SDumpArguments
*
arguments
,
FILE
*
fp
)
{
...
...
@@ -877,7 +879,7 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
int
fd
=
-
1
;
STableRecord
tableRecord
;
tstrncpy
(
tableRecord
.
metric
,
metric
,
TSDB_TABLE_NAME_LEN
);
//
tstrncpy(tableRecord.metric, metric, TSDB_TABLE_NAME_LEN);
sprintf
(
command
,
"select tbname from %s"
,
metric
);
TAOS_RES
*
result
=
taos_query
(
taos
,
command
);
...
...
@@ -898,8 +900,8 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
while
((
row
=
taos_fetch_row
(
result
))
!=
NULL
)
{
memset
(
&
tableRecord
,
0
,
sizeof
(
STableRecord
));
strncpy
(
tableRecord
.
name
,
(
char
*
)
row
[
0
],
fields
[
0
].
bytes
);
strcpy
(
tableRecord
.
metric
,
metric
);
t
strncpy
(
tableRecord
.
name
,
(
char
*
)
row
[
0
],
fields
[
0
].
bytes
);
tstrncpy
(
tableRecord
.
metric
,
metric
,
TSDB_TABLE_NAME_LEN
);
twrite
(
fd
,
&
tableRecord
,
sizeof
(
STableRecord
));
}
...
...
@@ -908,7 +910,8 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
while
(
1
)
{
while
(
1
)
{
memset
(
&
tableRecord
,
0
,
sizeof
(
STableRecord
));
ssize_t
ret
=
read
(
fd
,
&
tableRecord
,
sizeof
(
STableRecord
));
if
(
ret
<=
0
)
break
;
...
...
@@ -917,7 +920,7 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
taosDumpTable
(
tableRecord
.
name
,
tableRecord
.
metric
,
arguments
,
fp
);
}
t
close
(
fd
);
close
(
fd
);
(
void
)
remove
(
".table.tmp"
);
return
0
;
...
...
src/os/linux/src/linuxSysPara.c
浏览文件 @
02436e6d
...
...
@@ -162,7 +162,13 @@ static void taosGetSystemTimezone() {
FILE
*
f
=
fopen
(
"/etc/timezone"
,
"r"
);
char
buf
[
65
]
=
{
0
};
if
(
f
!=
NULL
)
{
(
void
)
fread
(
buf
,
64
,
1
,
f
);
int
len
=
fread
(
buf
,
64
,
1
,
f
);
if
(
len
<
64
&&
ferror
(
f
))
{
fclose
(
f
);
uError
(
"read /etc/timezone error, reason:%s"
,
strerror
(
errno
));
return
;
}
fclose
(
f
);
}
...
...
@@ -547,7 +553,7 @@ void taosSetCoreDump() {
struct
rlimit
rlim
;
struct
rlimit
rlim_new
;
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uPrint
(
"the old unlimited para: rlim_cur=%
d
, rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
uPrint
(
"the old unlimited para: rlim_cur=%
"
PRIu64
,
"
, rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
rlim_new
.
rlim_cur
=
RLIM_INFINITY
;
rlim_new
.
rlim_max
=
RLIM_INFINITY
;
if
(
setrlimit
(
RLIMIT_CORE
,
&
rlim_new
)
!=
0
)
{
...
...
@@ -559,7 +565,7 @@ void taosSetCoreDump() {
}
if
(
getrlimit
(
RLIMIT_CORE
,
&
rlim
)
==
0
)
{
uPrint
(
"the new unlimited para: rlim_cur=%
d
, rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
uPrint
(
"the new unlimited para: rlim_cur=%
"
PRIu64
,
"
, rlim_max=%"
PRIu64
,
rlim
.
rlim_cur
,
rlim
.
rlim_max
);
}
#ifndef _TD_ARM_
...
...
src/util/src/tlog.c
浏览文件 @
02436e6d
...
...
@@ -147,7 +147,7 @@ static void *taosThreadToOpenNewFile(void *param) {
return
NULL
;
}
taosLockFile
(
fd
);
lseek
(
fd
,
0
,
SEEK_SET
);
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
int32_t
oldFd
=
tsLogObj
.
logHandle
->
fd
;
tsLogObj
.
logHandle
->
fd
=
fd
;
...
...
src/util/src/tnote.c
浏览文件 @
02436e6d
...
...
@@ -92,7 +92,7 @@ void *taosThreadToOpenNewNote(void *param)
}
taosLockNote
(
fd
,
pNote
);
lseek
(
fd
,
0
,
SEEK_SET
);
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
int
oldFd
=
pNote
->
taosNoteFd
;
pNote
->
taosNoteFd
=
fd
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录