Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
add4b8fb
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
add4b8fb
编写于
6月 24, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
6月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
!492 Fix label-file reading bug
Merge pull request !492 from JingWoo/master
上级
93145e84
d5698095
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
4 addition
and
13 deletion
+4
-13
src/cmd/isula/base/create.c
src/cmd/isula/base/create.c
+3
-8
src/services/execution/spec/selinux_label.c
src/services/execution/spec/selinux_label.c
+1
-5
未找到文件。
src/cmd/isula/base/create.c
浏览文件 @
add4b8fb
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "arguments.h"
#include "arguments.h"
#include "isula_libutils/log.h"
#include "isula_libutils/log.h"
#include "utils.h"
#include "utils.h"
#include "utils_string.h"
#include "console.h"
#include "console.h"
#include "create.h"
#include "create.h"
#include "commands.h"
#include "commands.h"
...
@@ -433,7 +434,6 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
...
@@ -433,7 +434,6 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
FILE
*
fp
=
NULL
;
FILE
*
fp
=
NULL
;
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
size_t
len
;
size_t
len
;
ssize_t
num
;
if
(
file_size
==
0
)
{
if
(
file_size
==
0
)
{
return
0
;
return
0
;
...
@@ -444,14 +444,10 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
...
@@ -444,14 +444,10 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
return
-
1
;
return
-
1
;
}
}
__fsetlocking
(
fp
,
FSETLOCKING_BYCALLER
);
__fsetlocking
(
fp
,
FSETLOCKING_BYCALLER
);
num
=
getline
(
&
buf
,
&
len
,
fp
);
while
(
getline
(
&
buf
,
&
len
,
fp
)
!=
-
1
)
{
while
(
num
!=
-
1
)
{
if
(
strlen
(
util_trim_space
(
buf
))
==
0
)
{
size_t
len
=
strlen
(
buf
);
if
(
len
==
1
)
{
num
=
getline
(
&
buf
,
&
len
,
fp
);
continue
;
continue
;
}
}
buf
[
len
-
1
]
=
'\0'
;
if
(
!
validate_label
(
buf
))
{
if
(
!
validate_label
(
buf
))
{
COMMAND_ERROR
(
"Invalid label '%s': empty name"
,
buf
);
COMMAND_ERROR
(
"Invalid label '%s': empty name"
,
buf
);
ret
=
-
1
;
ret
=
-
1
;
...
@@ -462,7 +458,6 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
...
@@ -462,7 +458,6 @@ static int read_label_from_file(const char *path, size_t file_size, isula_contai
ret
=
-
1
;
ret
=
-
1
;
goto
out
;
goto
out
;
}
}
num
=
getline
(
&
buf
,
&
len
,
fp
);
}
}
out:
out:
...
...
src/services/execution/spec/selinux_label.c
浏览文件 @
add4b8fb
...
@@ -125,7 +125,6 @@ static void find_selinux_fs_among_mounts(char **fs)
...
@@ -125,7 +125,6 @@ static void find_selinux_fs_among_mounts(char **fs)
char
*
buf
=
NULL
;
char
*
buf
=
NULL
;
char
**
fields
=
NULL
;
char
**
fields
=
NULL
;
size_t
len
;
size_t
len
;
ssize_t
num
;
fp
=
fopen
(
"/proc/self/mountinfo"
,
"re"
);
fp
=
fopen
(
"/proc/self/mountinfo"
,
"re"
);
if
(
fp
==
NULL
)
{
if
(
fp
==
NULL
)
{
...
@@ -134,16 +133,13 @@ static void find_selinux_fs_among_mounts(char **fs)
...
@@ -134,16 +133,13 @@ static void find_selinux_fs_among_mounts(char **fs)
}
}
__fsetlocking
(
fp
,
FSETLOCKING_BYCALLER
);
__fsetlocking
(
fp
,
FSETLOCKING_BYCALLER
);
num
=
getline
(
&
buf
,
&
len
,
fp
);
while
(
getline
(
&
buf
,
&
len
,
fp
)
!=
-
1
)
{
while
(
num
!=
-
1
)
{
if
(
!
strstr
(
buf
,
" - selinuxfs "
))
{
if
(
!
strstr
(
buf
,
" - selinuxfs "
))
{
num
=
getline
(
&
buf
,
&
len
,
fp
);
continue
;
continue
;
}
}
fields
=
util_string_split
((
const
char
*
)
buf
,
' '
);
fields
=
util_string_split
((
const
char
*
)
buf
,
' '
);
if
(
fields
==
NULL
||
util_array_len
((
const
char
**
)
fields
)
<
MOUNT_POOINT_FIFTH_FIELD
+
1
)
{
if
(
fields
==
NULL
||
util_array_len
((
const
char
**
)
fields
)
<
MOUNT_POOINT_FIFTH_FIELD
+
1
)
{
util_free_array
(
fields
);
util_free_array
(
fields
);
num
=
getline
(
&
buf
,
&
len
,
fp
);
continue
;
continue
;
}
}
if
(
verify_selinuxfs_mount
(
fields
[
MOUNT_POOINT_FIFTH_FIELD
-
1
]))
{
if
(
verify_selinuxfs_mount
(
fields
[
MOUNT_POOINT_FIFTH_FIELD
-
1
]))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录