Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
adminstrot
TDengine
提交
ae88f4af
TDengine
项目概览
adminstrot
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ae88f4af
编写于
6月 08, 2020
作者:
S
Shengliang Guan
提交者:
GitHub
6月 08, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2190 from taosdata/coverity_scan
Coverity scan
上级
6c2e19c0
628bb019
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
75 addition
and
46 deletion
+75
-46
.gitignore
.gitignore
+2
-1
src/client/src/tscSub.c
src/client/src/tscSub.c
+3
-1
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+5
-4
src/kit/shell/src/shellImport.c
src/kit/shell/src/shellImport.c
+6
-1
src/kit/taosdemo/taosdemo.c
src/kit/taosdemo/taosdemo.c
+18
-19
src/kit/taosdump/taosdump.c
src/kit/taosdump/taosdump.c
+3
-3
src/mnode/src/mnodeAcct.c
src/mnode/src/mnodeAcct.c
+10
-5
src/mnode/src/mnodeMain.c
src/mnode/src/mnodeMain.c
+3
-3
src/mnode/src/mnodeShow.c
src/mnode/src/mnodeShow.c
+1
-1
src/os/linux/src/linuxSysPara.c
src/os/linux/src/linuxSysPara.c
+1
-1
src/plugins/http/src/httpUtil.c
src/plugins/http/src/httpUtil.c
+2
-2
src/plugins/http/src/tgHandle.c
src/plugins/http/src/tgHandle.c
+1
-1
src/util/src/tdes.c
src/util/src/tdes.c
+2
-0
src/util/src/tnote.c
src/util/src/tnote.c
+4
-0
src/vnode/src/vnodeMain.c
src/vnode/src/vnodeMain.c
+14
-4
未找到文件。
.gitignore
浏览文件 @
ae88f4af
...
...
@@ -64,4 +64,5 @@ CMakeError.log
/out/isenseconfig/WSL-Clang-Debug
/out/isenseconfig/WSL-GCC-Debug
/test/cfg
/src/.vs
/src/.vs
*.o
src/client/src/tscSub.c
浏览文件 @
ae88f4af
...
...
@@ -301,7 +301,9 @@ void tscSaveSubscriptionProgress(void* sub) {
char
path
[
256
];
sprintf
(
path
,
"%s/subscribe"
,
tsDataDir
);
if
(
access
(
path
,
0
)
!=
0
)
{
mkdir
(
path
,
0777
);
if
(
mkdir
(
path
,
0777
)
!=
0
&&
errno
!=
EEXIST
)
{
tscError
(
"failed to create subscribe dir: %s"
,
path
);
}
}
sprintf
(
path
,
"%s/subscribe/%s"
,
tsDataDir
,
pSub
->
topic
);
...
...
src/client/src/tscSystem.c
浏览文件 @
ae88f4af
...
...
@@ -80,9 +80,8 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
}
void
taos_init_imp
()
{
char
temp
[
128
];
struct
stat
dirstat
;
char
temp
[
128
];
errno
=
TSDB_CODE_SUCCESS
;
srand
(
taosGetTimestampSec
());
deltaToUtcInitOnce
();
...
...
@@ -94,7 +93,9 @@ void taos_init_imp() {
taosReadGlobalLogCfg
();
// For log directory
if
(
stat
(
tsLogDir
,
&
dirstat
)
<
0
)
mkdir
(
tsLogDir
,
0755
);
if
(
mkdir
(
tsLogDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
printf
(
"failed to create log dir:%s
\n
"
,
tsLogDir
);
}
sprintf
(
temp
,
"%s/taoslog"
,
tsLogDir
);
if
(
taosInitLog
(
temp
,
tsNumOfLogLines
,
10
)
<
0
)
{
...
...
src/kit/shell/src/shellImport.c
浏览文件 @
ae88f4af
...
...
@@ -148,7 +148,11 @@ static void shellSourceFile(TAOS *con, char *fptr) {
}
char
*
fname
=
full_path
.
we_wordv
[
0
];
if
(
fname
==
NULL
)
{
fprintf
(
stderr
,
"ERROR: invalid filename
\n
"
);
return
;
}
if
(
access
(
fname
,
F_OK
)
!=
0
)
{
fprintf
(
stderr
,
"ERROR: file %s is not exist
\n
"
,
fptr
);
...
...
@@ -169,6 +173,7 @@ static void shellSourceFile(TAOS *con, char *fptr) {
if
(
f
==
NULL
)
{
fprintf
(
stderr
,
"ERROR: failed to open file %s
\n
"
,
fname
);
wordfree
(
&
full_path
);
free
(
cmd
);
return
;
}
...
...
src/kit/taosdemo/taosdemo.c
浏览文件 @
ae88f4af
...
...
@@ -43,6 +43,7 @@ extern char configDir[];
#define MAX_DATA_SIZE 1024
#define MAX_NUM_DATATYPE 8
#define OPT_ABORT 1
/* –abort */
#define STRING_LEN 512
/* The options we understand. */
static
struct
argp_option
options
[]
=
{
...
...
@@ -380,10 +381,11 @@ int main(int argc, char *argv[]) {
bool
insert_only
=
arguments
.
insert_only
;
char
**
data_type
=
arguments
.
datatype
;
int
count_data_type
=
0
;
char
dataString
[
512
];
char
dataString
[
STRING_LEN
];
bool
do_aggreFunc
=
true
;
memset
(
dataString
,
0
,
512
);
memset
(
dataString
,
0
,
STRING_LEN
);
int
len
=
0
;
if
(
strcasecmp
(
data_type
[
0
],
"BINARY"
)
==
0
||
strcasecmp
(
data_type
[
0
],
"BOOL"
)
==
0
)
{
do_aggreFunc
=
false
;
...
...
@@ -392,8 +394,8 @@ int main(int argc, char *argv[]) {
if
(
strcasecmp
(
data_type
[
count_data_type
],
""
)
==
0
)
{
break
;
}
strcat
(
dataString
,
data_type
[
count_data_type
]);
strcat
(
dataString
,
" "
);
len
+=
snprintf
(
dataString
+
len
,
STRING_LEN
-
len
,
"%s "
,
data_type
[
count_data_type
]
);
}
FILE
*
fp
=
fopen
(
arguments
.
output_file
,
"a"
);
...
...
@@ -473,32 +475,29 @@ int main(int argc, char *argv[]) {
sprintf
(
command
,
"create database %s;"
,
db_name
);
taos_query
(
taos
,
command
);
char
cols
[
512
]
=
"
\0
"
;
char
cols
[
STRING_LEN
]
=
"
\0
"
;
int
colIndex
=
0
;
len
=
0
;
for
(;
colIndex
<
ncols_per_record
-
1
;
colIndex
++
)
{
if
(
strcasecmp
(
data_type
[
colIndex
%
count_data_type
],
"BINARY"
)
!=
0
)
{
sprintf
(
command
,
",f%d %s"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
]);
strcat
(
cols
,
command
);
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
]);
}
else
{
sprintf
(
command
,
",f%d %s(%d)"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
],
len_of_binary
);
strcat
(
cols
,
command
);
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s(%d)"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
],
len_of_binary
);
}
}
if
(
strcasecmp
(
data_type
[
colIndex
%
count_data_type
],
"BINARY"
)
!=
0
)
{
sprintf
(
command
,
",f%d %s)"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
]);
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s)"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
]);
}
else
{
sprintf
(
command
,
",f%d %s(%d))"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
],
len_of_binary
);
len
+=
snprintf
(
cols
+
len
,
STRING_LEN
-
len
,
",f%d %s(%d))"
,
colIndex
+
1
,
data_type
[
colIndex
%
count_data_type
],
len_of_binary
);
}
strcat
(
cols
,
command
);
if
(
!
use_metric
)
{
/* Create all the tables; */
printf
(
"Creating %d table(s)......
\n
"
,
ntables
);
for
(
int
i
=
0
;
i
<
ntables
;
i
++
)
{
s
printf
(
command
,
"create table %s.%s%d (ts timestamp%s;"
,
db_name
,
tb_prefix
,
i
,
cols
);
s
nprintf
(
command
,
BUFFER_SIZE
,
"create table %s.%s%d (ts timestamp%s;"
,
db_name
,
tb_prefix
,
i
,
cols
);
queryDB
(
taos
,
command
);
}
...
...
@@ -508,7 +507,7 @@ int main(int argc, char *argv[]) {
}
else
{
/* Create metric table */
printf
(
"Creating meters super table...
\n
"
);
s
printf
(
command
,
"create table %s.meters (ts timestamp%s tags (areaid int, loc binary(10))"
,
db_name
,
cols
);
s
nprintf
(
command
,
BUFFER_SIZE
,
"create table %s.meters (ts timestamp%s tags (areaid int, loc binary(10))"
,
db_name
,
cols
);
queryDB
(
taos
,
command
);
printf
(
"meters created!
\n
"
);
...
...
@@ -522,10 +521,10 @@ int main(int argc, char *argv[]) {
j
=
i
%
10
;
}
if
(
j
%
2
==
0
)
{
sprintf
(
command
,
"create table %s.%s%d using %s.meters tags (%d,
\"
%s
\"
);"
,
db_name
,
tb_prefix
,
i
,
db_name
,
j
,
"shanghai"
);
}
else
{
sprintf
(
command
,
"create table %s.%s%d using %s.meters tags (%d,
\"
%s
\"
);"
,
db_name
,
tb_prefix
,
i
,
db_name
,
j
,
"beijing"
);
}
snprintf
(
command
,
BUFFER_SIZE
,
"create table %s.%s%d using %s.meters tags (%d,
\"
%s
\"
);"
,
db_name
,
tb_prefix
,
i
,
db_name
,
j
,
"shanghai"
);
}
else
{
snprintf
(
command
,
BUFFER_SIZE
,
"create table %s.%s%d using %s.meters tags (%d,
\"
%s
\"
);"
,
db_name
,
tb_prefix
,
i
,
db_name
,
j
,
"beijing"
);
}
queryDB
(
taos
,
command
);
}
...
...
src/kit/taosdump/taosdump.c
浏览文件 @
ae88f4af
...
...
@@ -117,8 +117,8 @@ typedef struct {
}
SDbInfo
;
typedef
struct
{
char
name
[
TSDB_TABLE_NAME_LEN
+
1
];
char
metric
[
TSDB_TABLE_NAME_LEN
+
1
];
char
name
[
TSDB_TABLE_NAME_LEN
];
char
metric
[
TSDB_TABLE_NAME_LEN
];
}
STableRecord
;
typedef
struct
{
...
...
@@ -871,7 +871,7 @@ int32_t taosDumpMetric(char *metric, SDumpArguments *arguments, FILE *fp) {
int
fd
=
-
1
;
STableRecord
tableRecord
;
strcpy
(
tableRecord
.
metric
,
metric
);
tstrncpy
(
tableRecord
.
metric
,
metric
,
TSDB_TABLE_NAME_LEN
);
sprintf
(
command
,
"select tbname from %s"
,
metric
);
result
=
taos_query
(
taos
,
command
);
...
...
src/mnode/src/mnodeAcct.c
浏览文件 @
ae88f4af
...
...
@@ -27,7 +27,7 @@
void
*
tsAcctSdb
=
NULL
;
static
int32_t
tsAcctUpdateSize
;
static
void
mnodeCreateRootAcct
();
static
int32_t
mnodeCreateRootAcct
();
static
int32_t
mnodeAcctActionDestroy
(
SSdbOper
*
pOper
)
{
SAcctObj
*
pAcct
=
pOper
->
pObj
;
...
...
@@ -79,7 +79,11 @@ static int32_t mnodeAcctActionDecode(SSdbOper *pOper) {
static
int32_t
mnodeAcctActionRestored
()
{
if
(
dnodeIsFirstDeploy
())
{
mnodeCreateRootAcct
();
int32_t
code
=
mnodeCreateRootAcct
();
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
mError
(
"failed to create root account, reason:%s"
,
tstrerror
(
code
));
return
code
;
}
}
acctInit
();
...
...
@@ -161,9 +165,9 @@ void mnodeDropUserFromAcct(SAcctObj *pAcct, SUserObj *pUser) {
mnodeDecAcctRef
(
pAcct
);
}
static
void
mnodeCreateRootAcct
()
{
static
int32_t
mnodeCreateRootAcct
()
{
int32_t
numOfAccts
=
sdbGetNumOfRows
(
tsAcctSdb
);
if
(
numOfAccts
!=
0
)
return
;
if
(
numOfAccts
!=
0
)
return
TSDB_CODE_SUCCESS
;
SAcctObj
*
pAcct
=
malloc
(
sizeof
(
SAcctObj
));
memset
(
pAcct
,
0
,
sizeof
(
SAcctObj
));
...
...
@@ -190,7 +194,8 @@ static void mnodeCreateRootAcct() {
.
table
=
tsAcctSdb
,
.
pObj
=
pAcct
,
};
sdbInsertRow
(
&
oper
);
return
sdbInsertRow
(
&
oper
);
}
#ifndef _ACCT
...
...
src/mnode/src/mnodeMain.c
浏览文件 @
ae88f4af
...
...
@@ -88,9 +88,9 @@ int32_t mnodeStartSystem() {
}
mPrint
(
"starting to initialize mnode ..."
);
struct
stat
dirstat
;
if
(
stat
(
tsMnodeDir
,
&
dirstat
)
<
0
)
{
mkdir
(
tsMnodeDir
,
0755
)
;
if
(
mkdir
(
tsMnodeDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
mError
(
"failed to init mnode dir:%s, reason:%s"
,
tsMnodeDir
,
strerror
(
errno
));
return
-
1
;
}
dnodeAllocateMnodeWqueue
();
...
...
src/mnode/src/mnodeShow.c
浏览文件 @
ae88f4af
...
...
@@ -316,7 +316,7 @@ static int32_t mnodeProcessConnectMsg(SMnodeMsg *pMsg) {
}
sprintf
(
pConnectRsp
->
acctId
,
"%x"
,
pAcct
->
acctId
);
strcpy
(
pConnectRsp
->
serverVersion
,
version
);
memcpy
(
pConnectRsp
->
serverVersion
,
version
,
TSDB_VERSION_LEN
);
pConnectRsp
->
writeAuth
=
pUser
->
writeAuth
;
pConnectRsp
->
superAuth
=
pUser
->
superAuth
;
...
...
src/os/linux/src/linuxSysPara.c
浏览文件 @
ae88f4af
...
...
@@ -229,7 +229,7 @@ static void taosGetSystemLocale() { // get and set default locale
uError
(
"can't get locale from system, set it to en_US.UTF-8"
);
strcpy
(
tsLocale
,
"en_US.UTF-8"
);
}
else
{
strncpy
(
tsLocale
,
locale
,
tListLen
(
tsLocale
));
t
strncpy
(
tsLocale
,
locale
,
tListLen
(
tsLocale
));
uError
(
"locale not configured, set to system default:%s"
,
tsLocale
);
}
}
...
...
src/plugins/http/src/httpUtil.c
浏览文件 @
ae88f4af
...
...
@@ -32,12 +32,12 @@ bool httpCheckUsedbSql(char *sql) {
void
httpTimeToString
(
time_t
t
,
char
*
buf
,
int
buflen
)
{
memset
(
buf
,
0
,
(
size_t
)
buflen
);
char
ts
[
3
0
]
=
{
0
};
char
ts
[
3
2
]
=
{
0
};
struct
tm
*
ptm
;
time_t
tt
=
t
/
1000
;
ptm
=
localtime
(
&
tt
);
strftime
(
ts
,
64
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
strftime
(
ts
,
31
,
"%Y-%m-%d %H:%M:%S"
,
ptm
);
sprintf
(
buf
,
"%s.%03ld"
,
ts
,
t
%
1000
);
}
...
...
src/plugins/http/src/tgHandle.c
浏览文件 @
ae88f4af
...
...
@@ -313,7 +313,7 @@ bool tgGetPassFromUrl(HttpContext *pContext) {
return
false
;
}
strcpy
(
pContext
->
pass
,
pParser
->
path
[
TG_PASS_URL_POS
].
pos
);
tstrncpy
(
pContext
->
pass
,
pParser
->
path
[
TG_PASS_URL_POS
].
pos
,
TSDB_PASSWORD_LEN
);
return
true
;
}
...
...
src/util/src/tdes.c
浏览文件 @
ae88f4af
...
...
@@ -18,6 +18,7 @@ void generate_key(unsigned char* key);
void
generate_sub_keys
(
unsigned
char
*
main_key
,
key_set
*
key_sets
);
void
process_message
(
unsigned
char
*
message_piece
,
unsigned
char
*
processed_piece
,
key_set
*
key_sets
,
int
mode
);
#if 0
int64_t taosDesGenKey() {
unsigned int iseed = (unsigned int)time(NULL);
srand(iseed);
...
...
@@ -27,6 +28,7 @@ int64_t taosDesGenKey() {
return *((int64_t*)key);
}
#endif
char
*
taosDesImp
(
unsigned
char
*
key
,
char
*
src
,
unsigned
int
len
,
int
process_mode
)
{
unsigned
int
number_of_blocks
=
len
/
8
;
...
...
src/util/src/tnote.c
浏览文件 @
ae88f4af
...
...
@@ -87,6 +87,10 @@ void *taosThreadToOpenNewNote(void *param)
umask
(
0
);
int
fd
=
open
(
name
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
if
(
fd
<
0
)
{
return
NULL
;
}
taosLockNote
(
fd
,
pNote
);
lseek
(
fd
,
0
,
SEEK_SET
);
...
...
src/vnode/src/vnodeMain.c
浏览文件 @
ae88f4af
...
...
@@ -75,19 +75,29 @@ int32_t vnodeCreate(SMDCreateVnodeMsg *pVnodeCfg) {
return
TSDB_CODE_SUCCESS
;
}
mkdir
(
tsVnodeDir
,
0755
);
if
(
mkdir
(
tsVnodeDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
vError
(
"vgId:%d, failed to create vnode, reason:%s dir:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
strerror
(
errno
),
tsVnodeDir
);
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_VND_NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
return
TSDB_CODE_VND_NO_DISKSPACE
;
}
else
if
(
errno
==
ENOENT
)
{
return
TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR
;
}
else
{
return
TSDB_CODE_VND_INIT_FAILED
;
}
}
char
rootDir
[
TSDB_FILENAME_LEN
]
=
{
0
};
sprintf
(
rootDir
,
"%s/vnode%d"
,
tsVnodeDir
,
pVnodeCfg
->
cfg
.
vgId
);
if
(
mkdir
(
rootDir
,
0755
)
!=
0
)
{
v
Print
(
"vgId:%d, failed to create vnode, reason:%s dir:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
strerror
(
errno
),
rootDir
);
if
(
mkdir
(
rootDir
,
0755
)
!=
0
&&
errno
!=
EEXIST
)
{
v
Error
(
"vgId:%d, failed to create vnode, reason:%s dir:%s"
,
pVnodeCfg
->
cfg
.
vgId
,
strerror
(
errno
),
rootDir
);
if
(
errno
==
EACCES
)
{
return
TSDB_CODE_VND_NO_DISK_PERMISSIONS
;
}
else
if
(
errno
==
ENOSPC
)
{
return
TSDB_CODE_VND_NO_DISKSPACE
;
}
else
if
(
errno
==
ENOENT
)
{
return
TSDB_CODE_VND_NO_SUCH_FILE_OR_DIR
;
}
else
if
(
errno
==
EEXIST
)
{
}
else
{
return
TSDB_CODE_VND_INIT_FAILED
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录