Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
67d79ad7
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67d79ad7
编写于
6月 21, 2012
作者:
O
Osier Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
util: Use current uid and gid if they are passed as -1 for virDirCreate
All the callers of virDirCreate are updated incidentally.
上级
ea9509b9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
17 deletion
+12
-17
src/storage/storage_backend_fs.c
src/storage/storage_backend_fs.c
+6
-17
src/util/util.c
src/util/util.c
+6
-0
未找到文件。
src/storage/storage_backend_fs.c
浏览文件 @
67d79ad7
...
@@ -786,17 +786,10 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
...
@@ -786,17 +786,10 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Now create the final dir in the path with the uid/gid/mode
/* Now create the final dir in the path with the uid/gid/mode
* requested in the config. If the dir already exists, just set
* requested in the config. If the dir already exists, just set
* the perms. */
* the perms. */
uid_t
uid
;
gid_t
gid
;
uid
=
(
pool
->
def
->
target
.
perms
.
uid
==
(
uid_t
)
-
1
)
?
getuid
()
:
pool
->
def
->
target
.
perms
.
uid
;
gid
=
(
pool
->
def
->
target
.
perms
.
gid
==
(
gid_t
)
-
1
)
?
getgid
()
:
pool
->
def
->
target
.
perms
.
gid
;
if
((
err
=
virDirCreate
(
pool
->
def
->
target
.
path
,
if
((
err
=
virDirCreate
(
pool
->
def
->
target
.
path
,
pool
->
def
->
target
.
perms
.
mode
,
pool
->
def
->
target
.
perms
.
mode
,
uid
,
gid
,
pool
->
def
->
target
.
perms
.
uid
,
pool
->
def
->
target
.
perms
.
gid
,
VIR_DIR_CREATE_FORCE_PERMS
|
VIR_DIR_CREATE_FORCE_PERMS
|
VIR_DIR_CREATE_ALLOW_EXIST
|
VIR_DIR_CREATE_ALLOW_EXIST
|
(
pool
->
def
->
type
==
VIR_STORAGE_POOL_NETFS
(
pool
->
def
->
type
==
VIR_STORAGE_POOL_NETFS
...
@@ -808,9 +801,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
...
@@ -808,9 +801,9 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
/* Reflect the actual uid and gid to the config. */
/* Reflect the actual uid and gid to the config. */
if
(
pool
->
def
->
target
.
perms
.
uid
==
(
uid_t
)
-
1
)
if
(
pool
->
def
->
target
.
perms
.
uid
==
(
uid_t
)
-
1
)
pool
->
def
->
target
.
perms
.
uid
=
uid
;
pool
->
def
->
target
.
perms
.
uid
=
getuid
()
;
if
(
pool
->
def
->
target
.
perms
.
gid
==
(
gid_t
)
-
1
)
if
(
pool
->
def
->
target
.
perms
.
gid
==
(
gid_t
)
-
1
)
pool
->
def
->
target
.
perms
.
gid
=
g
id
;
pool
->
def
->
target
.
perms
.
gid
=
g
etgid
()
;
if
(
flags
!=
0
)
{
if
(
flags
!=
0
)
{
ret
=
virStorageBackendMakeFileSystem
(
pool
,
flags
);
ret
=
virStorageBackendMakeFileSystem
(
pool
,
flags
);
...
@@ -1050,13 +1043,9 @@ static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
...
@@ -1050,13 +1043,9 @@ static int createFileDir(virConnectPtr conn ATTRIBUTE_UNUSED,
return
-
1
;
return
-
1
;
}
}
uid_t
uid
=
(
vol
->
target
.
perms
.
uid
==
-
1
)
?
getuid
()
:
vol
->
target
.
perms
.
uid
;
gid_t
gid
=
(
vol
->
target
.
perms
.
gid
==
-
1
)
?
getgid
()
:
vol
->
target
.
perms
.
gid
;
if
((
err
=
virDirCreate
(
vol
->
target
.
path
,
vol
->
target
.
perms
.
mode
,
if
((
err
=
virDirCreate
(
vol
->
target
.
path
,
vol
->
target
.
perms
.
mode
,
uid
,
gid
,
vol
->
target
.
perms
.
uid
,
vol
->
target
.
perms
.
gid
,
VIR_DIR_CREATE_FORCE_PERMS
|
VIR_DIR_CREATE_FORCE_PERMS
|
(
pool
->
def
->
type
==
VIR_STORAGE_POOL_NETFS
(
pool
->
def
->
type
==
VIR_STORAGE_POOL_NETFS
?
VIR_DIR_CREATE_AS_UID
:
0
)))
<
0
)
{
?
VIR_DIR_CREATE_AS_UID
:
0
)))
<
0
)
{
...
...
src/util/util.c
浏览文件 @
67d79ad7
...
@@ -1126,6 +1126,12 @@ int virDirCreate(const char *path, mode_t mode,
...
@@ -1126,6 +1126,12 @@ int virDirCreate(const char *path, mode_t mode,
int
waitret
;
int
waitret
;
int
status
,
ret
=
0
;
int
status
,
ret
=
0
;
/* allow using -1 to mean "current value" */
if
(
uid
==
(
uid_t
)
-
1
)
uid
=
getuid
();
if
(
gid
==
(
gid_t
)
-
1
)
gid
=
getgid
();
if
((
!
(
flags
&
VIR_DIR_CREATE_AS_UID
))
if
((
!
(
flags
&
VIR_DIR_CREATE_AS_UID
))
||
(
getuid
()
!=
0
)
||
(
getuid
()
!=
0
)
||
((
uid
==
0
)
&&
(
gid
==
0
))
||
((
uid
==
0
)
&&
(
gid
==
0
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录