Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
752104bf
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看板
未验证
提交
752104bf
编写于
9月 01, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
9月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16568 from taosdata/fix/ZhiqiangWang/TD-18410-chmod-log-dir-mode
os: chmod log dir mode
上级
304c4f7f
22b56b79
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
1 deletion
+63
-1
include/os/osDir.h
include/os/osDir.h
+1
-0
packaging/deb/makedeb.sh
packaging/deb/makedeb.sh
+1
-0
source/common/src/tglobal.c
source/common/src/tglobal.c
+1
-1
source/os/src/osDir.c
source/os/src/osDir.c
+60
-0
未找到文件。
include/os/osDir.h
浏览文件 @
752104bf
...
@@ -56,6 +56,7 @@ void taosRemoveDir(const char *dirname);
...
@@ -56,6 +56,7 @@ void taosRemoveDir(const char *dirname);
bool
taosDirExist
(
const
char
*
dirname
);
bool
taosDirExist
(
const
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
int32_t
taosMulMkDir
(
const
char
*
dirname
);
int32_t
taosMulMkDir
(
const
char
*
dirname
);
int32_t
taosMulModeMkDir
(
const
char
*
dirname
,
int
mode
);
void
taosRemoveOldFiles
(
const
char
*
dirname
,
int32_t
keepDays
);
void
taosRemoveOldFiles
(
const
char
*
dirname
,
int32_t
keepDays
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosExpandDir
(
const
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
char
*
realPath
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
char
*
realPath
,
int32_t
maxlen
);
...
...
packaging/deb/makedeb.sh
浏览文件 @
752104bf
...
@@ -45,6 +45,7 @@ mkdir -p ${pkg_dir}${install_home_path}/include
...
@@ -45,6 +45,7 @@ mkdir -p ${pkg_dir}${install_home_path}/include
mkdir
-p
${
pkg_dir
}${
install_home_path
}
/script
mkdir
-p
${
pkg_dir
}${
install_home_path
}
/script
cp
${
compile_dir
}
/../packaging/cfg/taos.cfg
${
pkg_dir
}${
install_home_path
}
/cfg
cp
${
compile_dir
}
/../packaging/cfg/taos.cfg
${
pkg_dir
}${
install_home_path
}
/cfg
cp
${
compile_dir
}
/../packaging/cfg/taosd.service
${
pkg_dir
}${
install_home_path
}
/cfg
if
[
-f
"
${
compile_dir
}
/test/cfg/taosadapter.toml"
]
;
then
if
[
-f
"
${
compile_dir
}
/test/cfg/taosadapter.toml"
]
;
then
cp
${
compile_dir
}
/test/cfg/taosadapter.toml
${
pkg_dir
}${
install_home_path
}
/cfg
||
:
cp
${
compile_dir
}
/test/cfg/taosadapter.toml
${
pkg_dir
}${
install_home_path
}
/cfg
||
:
fi
fi
...
...
source/common/src/tglobal.c
浏览文件 @
752104bf
...
@@ -1133,7 +1133,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
...
@@ -1133,7 +1133,7 @@ int32_t taosCreateLog(const char *logname, int32_t logFileNum, const char *cfgDi
taosSetAllDebugFlag
(
cfgGetItem
(
pCfg
,
"debugFlag"
)
->
i32
,
false
);
taosSetAllDebugFlag
(
cfgGetItem
(
pCfg
,
"debugFlag"
)
->
i32
,
false
);
if
(
taosMulM
kDir
(
tsLogDir
)
!=
0
)
{
if
(
taosMulM
odeMkDir
(
tsLogDir
,
0777
)
!=
0
)
{
uError
(
"failed to create dir:%s since %s"
,
tsLogDir
,
terrstr
());
uError
(
"failed to create dir:%s since %s"
,
tsLogDir
,
terrstr
());
cfgCleanup
(
pCfg
);
cfgCleanup
(
pCfg
);
return
-
1
;
return
-
1
;
...
...
source/os/src/osDir.c
浏览文件 @
752104bf
...
@@ -160,6 +160,66 @@ int32_t taosMulMkDir(const char *dirname) {
...
@@ -160,6 +160,66 @@ int32_t taosMulMkDir(const char *dirname) {
return
code
;
return
code
;
}
}
int32_t
taosMulModeMkDir
(
const
char
*
dirname
,
int
mode
)
{
if
(
dirname
==
NULL
)
return
-
1
;
char
temp
[
1024
];
char
*
pos
=
temp
;
int32_t
code
=
0
;
#ifdef WINDOWS
taosRealPath
(
dirname
,
temp
,
sizeof
(
temp
));
if
(
temp
[
1
]
==
':'
)
pos
+=
3
;
#else
strcpy
(
temp
,
dirname
);
#endif
if
(
taosDirExist
(
temp
))
{
chmod
(
temp
,
mode
);
return
code
;
}
if
(
strncmp
(
temp
,
TD_DIRSEP
,
1
)
==
0
)
{
pos
+=
1
;
}
else
if
(
strncmp
(
temp
,
"."
TD_DIRSEP
,
2
)
==
0
)
{
pos
+=
2
;
}
for
(;
*
pos
!=
'\0'
;
pos
++
)
{
if
(
*
pos
==
TD_DIRSEP
[
0
])
{
*
pos
=
'\0'
;
#ifdef WINDOWS
code
=
_mkdir
(
temp
,
mode
);
#else
code
=
mkdir
(
temp
,
mode
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
code
;
}
*
pos
=
TD_DIRSEP
[
0
];
}
}
if
(
*
(
pos
-
1
)
!=
TD_DIRSEP
[
0
])
{
#ifdef WINDOWS
code
=
_mkdir
(
temp
,
mode
);
#else
code
=
mkdir
(
temp
,
mode
);
#endif
if
(
code
<
0
&&
errno
!=
EEXIST
)
{
terrno
=
TAOS_SYSTEM_ERROR
(
errno
);
return
code
;
}
}
if
(
code
<
0
&&
errno
==
EEXIST
)
{
chmod
(
temp
,
mode
);
return
0
;
}
chmod
(
temp
,
mode
);
return
code
;
}
void
taosRemoveOldFiles
(
const
char
*
dirname
,
int32_t
keepDays
)
{
void
taosRemoveOldFiles
(
const
char
*
dirname
,
int32_t
keepDays
)
{
TdDirPtr
pDir
=
taosOpenDir
(
dirname
);
TdDirPtr
pDir
=
taosOpenDir
(
dirname
);
if
(
pDir
==
NULL
)
return
;
if
(
pDir
==
NULL
)
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录