Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
f843a22b
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看板
提交
f843a22b
编写于
4月 10, 2020
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[td-98]fix uninitialised value access warning by valgrind
上级
54f28dc5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
32 deletion
+37
-32
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+37
-32
未找到文件。
src/util/src/tglobalcfg.c
浏览文件 @
f843a22b
...
...
@@ -14,13 +14,12 @@
*/
#include "os.h"
#include <locale.h>
#include "taosdef.h"
#include "taoserror.h"
#include "tglobalcfg.h"
#include "tkey.h"
#include "tlog.h"
#include "taosdef.h"
#include "taoserror.h"
#include "tsocket.h"
#include "tsystem.h"
#include "tutil.h"
...
...
@@ -833,9 +832,8 @@ void tsReadGlobalLogConfig() {
FILE
*
fp
;
char
*
line
,
*
option
,
*
value
;
size_t
len
;
int
olen
,
vlen
;
char
fileName
[
128
]
;
char
fileName
[
PATH_MAX
]
=
{
0
}
;
mdebugFlag
=
135
;
sdbDebugFlag
=
135
;
...
...
@@ -851,27 +849,30 @@ void tsReadGlobalLogConfig() {
wordfree
(
&
full_path
);
tsReadLogOption
(
"logDir"
,
logDir
);
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
fp
=
fopen
(
fileName
,
"r"
);
if
(
fp
==
NULL
)
{
printf
(
"
\n
option file:%s not found, all options are set to system
default
\n
"
,
fileName
);
printf
(
"
\n
config file:%s not found, all variables are set to
default
\n
"
,
fileName
);
return
;
}
line
=
NULL
;
size_t
len
=
1024
;
line
=
calloc
(
1
,
len
);
while
(
!
feof
(
fp
))
{
tfree
(
line
);
line
=
option
=
value
=
NULL
;
len
=
olen
=
vlen
=
0
;
memset
(
line
,
0
,
len
);
option
=
value
=
NULL
;
olen
=
vlen
=
0
;
getline
(
&
line
,
&
len
,
fp
);
if
(
line
==
NULL
)
break
;
paGetToken
(
line
,
&
option
,
&
olen
);
paGetToken
(
line
,
len
,
&
option
,
&
olen
);
if
(
olen
==
0
)
continue
;
option
[
olen
]
=
0
;
paGetToken
(
option
+
olen
+
1
,
&
value
,
&
vlen
);
paGetToken
(
option
+
olen
+
1
,
len
,
&
value
,
&
vlen
);
if
(
vlen
==
0
)
continue
;
value
[
vlen
]
=
0
;
...
...
@@ -885,44 +886,45 @@ void tsReadGlobalLogConfig() {
bool
tsReadGlobalConfig
()
{
tsInitGlobalConfig
();
FILE
*
fp
;
char
*
line
,
*
option
,
*
value
,
*
value1
;
size_t
len
;
int
olen
,
vlen
,
vlen1
;
char
fileName
[
128
]
;
char
fileName
[
PATH_MAX
]
=
{
0
}
;
sprintf
(
fileName
,
"%s/taos.cfg"
,
configDir
);
fp
=
fopen
(
fileName
,
"r"
);
if
(
fp
==
NULL
)
{
}
else
{
line
=
NULL
;
FILE
*
fp
=
fopen
(
fileName
,
"r"
);
size_t
len
=
1024
;
line
=
calloc
(
1
,
len
);
if
(
fp
!=
NULL
)
{
while
(
!
feof
(
fp
))
{
tfree
(
line
);
line
=
option
=
value
=
NULL
;
len
=
olen
=
vlen
=
0
;
memset
(
line
,
0
,
len
);
option
=
value
=
NULL
;
olen
=
vlen
=
0
;
getline
(
&
line
,
&
len
,
fp
);
if
(
line
==
NULL
)
break
;
paGetToken
(
line
,
&
option
,
&
olen
);
paGetToken
(
line
,
len
,
&
option
,
&
olen
);
if
(
olen
==
0
)
continue
;
option
[
olen
]
=
0
;
paGetToken
(
option
+
olen
+
1
,
&
value
,
&
vlen
);
paGetToken
(
option
+
olen
+
1
,
len
,
&
value
,
&
vlen
);
if
(
vlen
==
0
)
continue
;
value
[
vlen
]
=
0
;
// For dataDir, the format is:
// dataDir /mnt/disk1 0
paGetToken
(
value
+
vlen
+
1
,
&
value1
,
&
vlen1
);
paGetToken
(
value
+
vlen
+
1
,
len
,
&
value1
,
&
vlen1
);
tsReadConfigOption
(
option
,
value
);
}
tfree
(
line
);
fclose
(
fp
);
}
tfree
(
line
);
if
(
tsReadStorageConfig
)
{
tsReadStorageConfig
();
}
...
...
@@ -976,6 +978,7 @@ bool tsReadGlobalConfig() {
strcpy
(
tsLocalIp
,
tsPrivateIp
);
}
// todo refactor
tsVersion
=
0
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
if
(
version
[
i
]
>=
'0'
&&
version
[
i
]
<=
'9'
)
{
...
...
@@ -984,6 +987,7 @@ bool tsReadGlobalConfig() {
break
;
}
}
tsVersion
=
10
*
tsVersion
;
return
true
;
...
...
@@ -994,10 +998,11 @@ int tsCfgDynamicOptions(char *msg) {
int
olen
,
vlen
,
code
=
0
;
int
vint
=
0
;
paGetToken
(
msg
,
&
option
,
&
olen
);
size_t
len
=
120
;
paGetToken
(
msg
,
len
,
&
option
,
&
olen
);
if
(
olen
==
0
)
return
TSDB_CODE_INVALID_MSG_CONTENT
;
paGetToken
(
option
+
olen
+
1
,
&
value
,
&
vlen
);
paGetToken
(
option
+
olen
+
1
,
len
,
&
value
,
&
vlen
);
if
(
vlen
==
0
)
vint
=
135
;
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录