Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
76fad65b
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,发现更多精彩内容 >>
提交
76fad65b
编写于
7月 04, 2013
作者:
M
Michal Privoznik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adapt to VIR_ALLOC and virAsprintf in tools/*
上级
3ea84b95
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
10 addition
and
29 deletion
+10
-29
tools/console.c
tools/console.c
+1
-5
tools/virsh-domain-monitor.c
tools/virsh-domain-monitor.c
+1
-3
tools/virsh-domain.c
tools/virsh-domain.c
+8
-20
tools/virsh.c
tools/virsh.c
+0
-1
未找到文件。
tools/console.c
浏览文件 @
76fad65b
...
...
@@ -128,7 +128,6 @@ virConsoleEventOnStream(virStreamPtr st,
if
(
avail
<
1024
)
{
if
(
VIR_REALLOC_N
(
con
->
streamToTerminal
.
data
,
con
->
streamToTerminal
.
length
+
1024
)
<
0
)
{
virReportOOMError
();
virConsoleShutdown
(
con
);
return
;
}
...
...
@@ -204,7 +203,6 @@ virConsoleEventOnStdin(int watch ATTRIBUTE_UNUSED,
if
(
avail
<
1024
)
{
if
(
VIR_REALLOC_N
(
con
->
terminalToStream
.
data
,
con
->
terminalToStream
.
length
+
1024
)
<
0
)
{
virReportOOMError
();
virConsoleShutdown
(
con
);
return
;
}
...
...
@@ -357,10 +355,8 @@ int vshRunConsole(virDomainPtr dom,
old_sigpipe
=
signal
(
SIGPIPE
,
do_signal
);
got_signal
=
0
;
if
(
VIR_ALLOC
(
con
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC
(
con
)
<
0
)
goto
cleanup
;
}
con
->
escapeChar
=
vshGetEscapeChar
(
escape_seq
);
con
->
st
=
virStreamNew
(
virDomainGetConnect
(
dom
),
...
...
tools/virsh-domain-monitor.c
浏览文件 @
76fad65b
...
...
@@ -709,10 +709,8 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd)
if
(
virAsprintf
(
&
xpath
,
"/domain/devices/interface[(mac/@address = '%s') or "
" (target/@dev = '%s')]"
,
macstr
,
iface
)
<
0
)
{
virReportOOMError
();
macstr
,
iface
)
<
0
)
goto
cleanup
;
}
if
((
ninterfaces
=
virXPathNodeSet
(
xpath
,
ctxt
,
&
interfaces
))
<
0
)
{
vshError
(
ctl
,
_
(
"Failed to extract interface information"
));
...
...
tools/virsh-domain.c
浏览文件 @
76fad65b
...
...
@@ -6275,7 +6275,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd)
}
if
(
VIR_ALLOC_N
(
params
,
nparams
*
MIN
(
show_count
,
128
))
<
0
)
goto
no_memory
;
goto
cleanup
;
while
(
show_count
)
{
int
ncpus
=
MIN
(
show_count
,
128
);
...
...
@@ -6324,7 +6324,7 @@ do_show_total:
}
if
(
VIR_ALLOC_N
(
params
,
nparams
)
<
0
)
goto
no_memory
;
goto
cleanup
;
/* passing start_cpu == -1 gives us domain's total status */
if
((
nparams
=
virDomainGetCPUStats
(
dom
,
params
,
nparams
,
-
1
,
1
,
flags
))
<
0
)
...
...
@@ -6354,10 +6354,6 @@ cleanup:
virDomainFree
(
dom
);
return
ret
;
no_memory:
virReportOOMError
();
goto
cleanup
;
failed_stats:
vshError
(
ctl
,
_
(
"Failed to retrieve CPU statistics for domain '%s'"
),
virDomainGetName
(
dom
));
...
...
@@ -8843,7 +8839,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
for
(
iter
=
0
;
scheme
[
iter
]
!=
NULL
;
iter
++
)
{
/* Create our XPATH lookup for the current display's port */
if
(
virAsprintf
(
&
xpath
,
xpath_fmt
,
scheme
[
iter
],
"port"
)
<
0
)
goto
no_memory
;
goto
cleanup
;
/* Attempt to get the port number for the current graphics scheme */
tmp
=
virXPathInt
(
xpath
,
ctxt
,
&
port
);
...
...
@@ -8856,7 +8852,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
/* Create our XPATH lookup for the current display's address */
if
(
virAsprintf
(
&
xpath
,
xpath_fmt
,
scheme
[
iter
],
"listen"
)
<
0
)
goto
no_memory
;
goto
cleanup
;
/* Attempt to get the listening addr if set for the current
* graphics scheme */
...
...
@@ -8870,7 +8866,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
/* Create our XPATH lookup for the password */
if
(
virAsprintf
(
&
xpath
,
xpath_fmt
,
scheme
[
iter
],
"passwd"
)
<
0
)
goto
no_memory
;
goto
cleanup
;
/* Attempt to get the password */
passwd
=
virXPathString
(
xpath
,
ctxt
);
...
...
@@ -8885,7 +8881,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
/* Create our XPATH lookup for TLS Port (automatically skipped
* for unsupported schemes */
if
(
virAsprintf
(
&
xpath
,
xpath_fmt
,
scheme
[
iter
],
"tlsPort"
)
<
0
)
goto
no_memory
;
goto
cleanup
;
/* Attempt to get the TLS port number */
tmp
=
virXPathInt
(
xpath
,
ctxt
,
&
tls_port
);
...
...
@@ -8951,10 +8947,6 @@ cleanup:
xmlFreeDoc
(
xml
);
virDomainFree
(
dom
);
return
ret
;
no_memory:
virReportOOMError
();
goto
cleanup
;
}
/*
...
...
@@ -9192,10 +9184,8 @@ vshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
if
(
n1_child_size
==
0
&&
n2_child_size
==
0
)
return
true
;
if
(
!
(
bitmap
=
virBitmapNew
(
n1_child_size
)))
{
virReportOOMError
();
if
(
!
(
bitmap
=
virBitmapNew
(
n1_child_size
)))
return
false
;
}
child2
=
n2
->
children
;
while
(
child2
)
{
...
...
@@ -9841,10 +9831,8 @@ cleanup:
VIR_FREE
(
disk_type
);
if
(
xml_buf
)
{
int
len
=
xmlBufferLength
(
xml_buf
);
if
(
VIR_ALLOC_N
(
ret
,
len
+
1
)
<
0
)
{
virReportOOMError
();
if
(
VIR_ALLOC_N
(
ret
,
len
+
1
)
<
0
)
return
NULL
;
}
memcpy
(
ret
,
(
char
*
)
xmlBufferContent
(
xml_buf
),
len
);
ret
[
len
]
=
'\0'
;
xmlBufferFree
(
xml_buf
);
...
...
tools/virsh.c
浏览文件 @
76fad65b
...
...
@@ -197,7 +197,6 @@ vshStringToArray(const char *str,
}
if
(
VIR_ALLOC_N
(
arr
,
nstr_tokens
)
<
0
)
{
virReportOOMError
();
VIR_FREE
(
str_copied
);
return
-
1
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录