Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
a6c612a4
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看板
提交
a6c612a4
编写于
4月 16, 2009
作者:
G
Guido Günther
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
don't hardcode buffer for getgrnam_r to 1024 bytes and increase it on ERANGE.
上级
9fa79000
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
2 deletion
+30
-2
ChangeLog
ChangeLog
+5
-0
qemud/qemud.c
qemud/qemud.c
+25
-2
未找到文件。
ChangeLog
浏览文件 @
a6c612a4
Do Apr 16 16:48:51 CEST 2009 Guido Günther <agx@sigxcpu.org>
* src/qemud.c (remoteReadConfigFile): don't hardcode buffer for
getgrnam_r to 1024 bytes and increase it on ERANGE.
Thu Apr 16 15:20:02 GMT 2009 Mark McLoughlin <markmc@redhat.com>
* src/qemu_conf.c: pass "format=" to qemu -drive rather
...
...
qemud/qemud.c
浏览文件 @
a6c612a4
...
...
@@ -2529,6 +2529,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
char
*
unix_sock_ro_perms
=
NULL
;
char
*
unix_sock_rw_perms
=
NULL
;
char
*
unix_sock_group
=
NULL
;
char
*
buf
=
NULL
;
#if HAVE_POLKIT
/* Change the default back to no auth for non-root */
...
...
@@ -2574,13 +2575,34 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
if
(
getuid
()
!=
0
)
{
VIR_WARN0
(
_
(
"Cannot set group when not running as root"
));
}
else
{
char
buf
[
1024
]
;
int
ret
;
struct
group
grpdata
,
*
grp
;
if
(
getgrnam_r
(
unix_sock_group
,
&
grpdata
,
buf
,
sizeof
(
buf
),
&
grp
)
!=
0
||
!
grp
)
{
size_t
maxbuf
=
sysconf
(
_SC_GETGR_R_SIZE_MAX
);
if
(
maxbuf
==
-
1
)
maxbuf
=
1024
;
if
(
VIR_ALLOC_N
(
buf
,
maxbuf
)
<
0
)
{
VIR_ERROR
(
"%s"
,
_
(
"Failed to allocate memory for buffer"
));
goto
free_and_fail
;
}
while
((
ret
=
getgrnam_r
(
unix_sock_group
,
&
grpdata
,
buf
,
maxbuf
,
&
grp
))
==
ERANGE
)
{
maxbuf
*=
2
;
if
(
maxbuf
>
65536
||
VIR_REALLOC_N
(
buf
,
maxbuf
)
<
0
)
{
VIR_ERROR
(
"%s"
,
_
(
"Failed to reallocate enough memory for buffer"
));
goto
free_and_fail
;
}
}
if
(
ret
!=
0
||
!
grp
)
{
VIR_ERROR
(
_
(
"Failed to lookup group '%s'"
),
unix_sock_group
);
goto
free_and_fail
;
}
unix_sock_gid
=
grp
->
gr_gid
;
VIR_FREE
(
buf
);
}
free
(
unix_sock_group
);
unix_sock_group
=
NULL
;
...
...
@@ -2643,6 +2665,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
free
(
unix_sock_ro_perms
);
free
(
unix_sock_rw_perms
);
free
(
unix_sock_group
);
VIR_FREE
(
buf
);
/* Don't bother trying to free listen_addr, tcp_port, tls_port, key_file,
cert_file, ca_file, or crl_file, since they are initialized to
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录