Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
KASAKI11
TDengine
提交
e1370ae2
T
TDengine
项目概览
KASAKI11
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e1370ae2
编写于
6月 23, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[modify for coverity scan]
上级
4ac333b3
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
25 deletion
+32
-25
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+19
-10
src/util/src/tconfig.c
src/util/src/tconfig.c
+7
-10
src/util/src/tlog.c
src/util/src/tlog.c
+5
-4
src/util/src/ttime.c
src/util/src/ttime.c
+1
-1
未找到文件。
src/kit/taosdump/taosdump.c
浏览文件 @
e1370ae2
...
@@ -644,14 +644,15 @@ int taosDumpDb(SDbInfo *dbInfo, SDumpArguments *arguments, FILE *fp) {
...
@@ -644,14 +644,15 @@ int taosDumpDb(SDbInfo *dbInfo, SDumpArguments *arguments, FILE *fp) {
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
STableRecord
tableInfo
;
while
(
1
)
{
while
(
1
)
{
memset
(
&
table
Record
,
0
,
sizeof
(
STableRecord
));
memset
(
&
table
Info
,
0
,
sizeof
(
STableRecord
));
ssize_t
ret
=
read
(
fd
,
&
table
Record
,
sizeof
(
STableRecord
));
ssize_t
ret
=
read
(
fd
,
&
table
Info
,
sizeof
(
STableRecord
));
if
(
ret
<=
0
)
break
;
if
(
ret
<=
0
)
break
;
table
Record
.
name
[
sizeof
(
tableRecord
.
name
)
-
1
]
=
0
;
table
Info
.
name
[
sizeof
(
tableInfo
.
name
)
-
1
]
=
0
;
table
Record
.
metric
[
sizeof
(
tableRecord
.
metric
)
-
1
]
=
0
;
table
Info
.
metric
[
sizeof
(
tableInfo
.
metric
)
-
1
]
=
0
;
taosDumpTable
(
table
Record
.
name
,
tableRecord
.
metric
,
arguments
,
fp
);
taosDumpTable
(
table
Info
.
name
,
tableInfo
.
metric
,
arguments
,
fp
);
}
}
close
(
fd
);
close
(
fd
);
...
@@ -910,14 +911,22 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
...
@@ -910,14 +911,22 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
(
void
)
lseek
(
fd
,
0
,
SEEK_SET
);
STableRecord
tableInfo
;
char
tableName
[
TSDB_TABLE_NAME_LEN
]
;
char
metricName
[
TSDB_TABLE_NAME_LEN
];
while
(
1
)
{
while
(
1
)
{
memset
(
&
tableRecord
,
0
,
sizeof
(
STableRecord
));
memset
(
&
tableInfo
,
0
,
sizeof
(
STableRecord
));
ssize_t
ret
=
read
(
fd
,
&
tableRecord
,
sizeof
(
STableRecord
));
memset
(
tableName
,
0
,
TSDB_TABLE_NAME_LEN
);
memset
(
metricName
,
0
,
TSDB_TABLE_NAME_LEN
);
ssize_t
ret
=
read
(
fd
,
&
tableInfo
,
sizeof
(
STableRecord
));
if
(
ret
<=
0
)
break
;
if
(
ret
<=
0
)
break
;
tableRecord
.
name
[
sizeof
(
tableRecord
.
name
)
-
1
]
=
0
;
//tableInfo.name[sizeof(tableInfo.name) - 1] = 0;
tableRecord
.
metric
[
sizeof
(
tableRecord
.
metric
)
-
1
]
=
0
;
//tableInfo.metric[sizeof(tableInfo.metric) - 1] = 0;
taosDumpTable
(
tableRecord
.
name
,
tableRecord
.
metric
,
arguments
,
fp
);
//taosDumpTable(tableInfo.name, tableInfo.metric, arguments, fp);
tstrncpy
(
tableName
,
tableInfo
.
name
,
TSDB_TABLE_NAME_LEN
-
1
);
tstrncpy
(
metricName
,
tableInfo
.
metric
,
TSDB_TABLE_NAME_LEN
-
1
);
taosDumpTable
(
tableName
,
metricName
,
arguments
,
fp
);
}
}
close
(
fd
);
close
(
fd
);
...
...
src/util/src/tconfig.c
浏览文件 @
e1370ae2
...
@@ -111,21 +111,18 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
...
@@ -111,21 +111,18 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
return
;
return
;
}
}
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
if
(
full_path
.
we_wordv
!=
NULL
&&
full_path
.
we_wordv
[
0
]
!=
NULL
)
{
strcpy
(
option
,
full_path
.
we_wordv
[
0
]);
strcpy
(
option
,
full_path
.
we_wordv
[
0
]);
}
}
wordfree
(
&
full_path
);
wordfree
(
&
full_path
);
struct
stat
dirstat
;
int
code
=
tmkdir
(
option
,
0755
);
if
(
stat
(
option
,
&
dirstat
)
<
0
)
{
if
(
code
!=
0
)
{
int
code
=
mkdir
(
option
,
0755
);
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
if
(
code
<
0
)
{
uError
(
"config option:%s, input value:%s, directory not exist, create fail:%s"
,
uError
(
"config option:%s, input value:%s, directory not exist, create fail with return code:%d"
,
cfg
->
option
,
input_value
,
strerror
(
errno
));
cfg
->
option
,
input_value
,
code
);
}
else
{
uPrint
(
"config option:%s, input value:%s, directory not exist, create with return code:%d"
,
cfg
->
option
,
input_value
,
code
);
}
}
}
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_FILE
;
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_FILE
;
}
else
{
}
else
{
...
...
src/util/src/tlog.c
浏览文件 @
e1370ae2
...
@@ -276,14 +276,15 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
...
@@ -276,14 +276,15 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
}
}
}
}
sprintf
(
name
,
"%s.%d"
,
tsLogObj
.
logName
,
tsLogObj
.
flag
);
char
fileName
[
LOG_FILE_NAME_LEN
+
50
]
=
"
\0
"
;
sprintf
(
fileName
,
"%s.%d"
,
tsLogObj
.
logName
,
tsLogObj
.
flag
);
pthread_mutex_init
(
&
tsLogObj
.
logMutex
,
NULL
);
pthread_mutex_init
(
&
tsLogObj
.
logMutex
,
NULL
);
umask
(
0
);
umask
(
0
);
tsLogObj
.
logHandle
->
fd
=
open
(
n
ame
,
O_WRONLY
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
tsLogObj
.
logHandle
->
fd
=
open
(
fileN
ame
,
O_WRONLY
|
O_CREAT
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
tsLogObj
.
logHandle
->
fd
<
0
)
{
if
(
tsLogObj
.
logHandle
->
fd
<
0
)
{
printf
(
"
\n
failed to open log file:%s, reason:%s
\n
"
,
n
ame
,
strerror
(
errno
));
printf
(
"
\n
failed to open log file:%s, reason:%s
\n
"
,
fileN
ame
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
taosLockFile
(
tsLogObj
.
logHandle
->
fd
);
taosLockFile
(
tsLogObj
.
logHandle
->
fd
);
...
@@ -291,7 +292,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
...
@@ -291,7 +292,7 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
// only an estimate for number of lines
// only an estimate for number of lines
struct
stat
filestat
;
struct
stat
filestat
;
if
(
fstat
(
tsLogObj
.
logHandle
->
fd
,
&
filestat
)
<
0
)
{
if
(
fstat
(
tsLogObj
.
logHandle
->
fd
,
&
filestat
)
<
0
)
{
printf
(
"
\n
failed to fstat log file:%s, reason:%s
\n
"
,
n
ame
,
strerror
(
errno
));
printf
(
"
\n
failed to fstat log file:%s, reason:%s
\n
"
,
fileN
ame
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
size
=
(
int32_t
)
filestat
.
st_size
;
size
=
(
int32_t
)
filestat
.
st_size
;
...
...
src/util/src/ttime.c
浏览文件 @
e1370ae2
...
@@ -56,7 +56,7 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
...
@@ -56,7 +56,7 @@ int64_t user_mktime64(const unsigned int year0, const unsigned int mon0,
year
-=
1
;
year
-=
1
;
}
}
int64_t
res
=
(((((
int64_t
)
(
year
/
4
-
year
/
100
+
year
/
400
+
367
*
mon
/
12
+
day
)
+
int64_t
res
=
(((((
int64_t
)
(
year
/
4
-
year
/
100
+
year
/
400
+
(
int64_t
)(
367
*
mon
)
/
12
+
day
)
+
year
*
365
-
719499
)
*
24
+
hour
)
*
60
+
min
)
*
60
+
sec
);
year
*
365
-
719499
)
*
24
+
hour
)
*
60
+
min
)
*
60
+
sec
);
return
(
res
+
timezone
);
return
(
res
+
timezone
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录