Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
adf43845
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看板
提交
adf43845
编写于
5月 19, 2009
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use virAsprintf, rather than VIR_ALLOC + strcpy + strcat
上级
bb175dfc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
49 deletion
+39
-49
ChangeLog
ChangeLog
+7
-0
qemud/remote.c
qemud/remote.c
+4
-5
src/remote_internal.c
src/remote_internal.c
+2
-5
src/storage_backend.c
src/storage_backend.c
+3
-6
src/storage_backend_fs.c
src/storage_backend_fs.c
+13
-16
src/storage_backend_logical.c
src/storage_backend_logical.c
+4
-5
src/test.c
src/test.c
+6
-12
未找到文件。
ChangeLog
浏览文件 @
adf43845
Tue May 19 09:14:12 EDT 2009 Cole Robinson <crobinso@redhat.com>
Use virAsprintf, rather than VIR_ALLOC + strcpy + strcat
* qemud/remote.c src/remote_internal.c src/storage_backend.c
src/storage_backend_fs.c src/storage_backend_logical.c
src/test.c
Tue May 19 09:04:05 EDT 2009 Cole Robinson <crobinso@redhat.com>
* src/virsh.c: Don't validate disk type in virsh attach-disk
...
...
qemud/remote.c
浏览文件 @
adf43845
...
...
@@ -52,7 +52,9 @@
#include "datatypes.h"
#include "qemud.h"
#include "memory.h"
#include "util.h"
#define VIR_FROM_THIS VIR_FROM_REMOTE
#define REMOTE_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__)
static
void
remoteDispatchFormatError
(
remote_error
*
rerr
,
...
...
@@ -2602,14 +2604,11 @@ static char *addrToString(remote_error *rerr,
return
NULL
;
}
if
(
VIR_ALLOC_N
(
addr
,
strlen
(
host
)
+
1
+
strlen
(
port
)
+
1
)
<
0
)
{
remoteDispatchOOMError
(
rerr
);
if
(
virAsprintf
(
&
addr
,
"%s;%s"
,
host
,
port
)
==
-
1
)
{
virReportOOMError
(
NULL
);
return
NULL
;
}
strcpy
(
addr
,
host
);
strcat
(
addr
,
";"
);
strcat
(
addr
,
port
);
return
addr
;
}
...
...
src/remote_internal.c
浏览文件 @
adf43845
...
...
@@ -5189,14 +5189,11 @@ static char *addrToString(struct sockaddr_storage *sa, socklen_t salen)
return
NULL
;
}
if
(
VIR_ALLOC_N
(
addr
,
strlen
(
host
)
+
1
+
strlen
(
port
)
+
1
)
<
0
)
{
virReportOOMError
(
NULL
);
if
(
virAsprintf
(
&
addr
,
"%s;%s"
,
host
,
port
)
==
-
1
)
{
virReportOOMError
(
NULL
);
return
NULL
;
}
strcpy
(
addr
,
host
);
strcat
(
addr
,
";"
);
strcat
(
addr
,
port
);
return
addr
;
}
...
...
src/storage_backend.c
浏览文件 @
adf43845
...
...
@@ -342,17 +342,14 @@ virStorageBackendStablePath(virConnectPtr conn,
if
(
dent
->
d_name
[
0
]
==
'.'
)
continue
;
if
(
VIR_ALLOC_N
(
stablepath
,
strlen
(
pool
->
def
->
target
.
path
)
+
1
+
strlen
(
dent
->
d_name
)
+
1
)
<
0
)
{
if
(
virAsprintf
(
&
stablepath
,
"%s/%s"
,
pool
->
def
->
target
.
path
,
dent
->
d_name
)
==
-
1
)
{
virReportOOMError
(
conn
);
closedir
(
dh
);
return
NULL
;
}
strcpy
(
stablepath
,
pool
->
def
->
target
.
path
);
strcat
(
stablepath
,
"/"
);
strcat
(
stablepath
,
dent
->
d_name
);
if
(
virFileLinkPointsTo
(
stablepath
,
devpath
))
{
closedir
(
dh
);
return
stablepath
;
...
...
src/storage_backend_fs.c
浏览文件 @
adf43845
...
...
@@ -668,14 +668,13 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
}
if
(
pool
->
def
->
type
==
VIR_STORAGE_POOL_NETFS
)
{
if
(
VIR_ALLOC_N
(
src
,
strlen
(
pool
->
def
->
source
.
host
.
name
)
+
1
+
strlen
(
pool
->
def
->
source
.
dir
)
+
1
)
<
0
)
{
if
(
virAsprintf
(
&
src
,
"%s:%s"
,
pool
->
def
->
source
.
host
.
name
,
pool
->
def
->
source
.
dir
)
==
-
1
)
{
virReportOOMError
(
conn
);
return
-
1
;
}
strcpy
(
src
,
pool
->
def
->
source
.
host
.
name
);
strcat
(
src
,
":"
);
strcat
(
src
,
pool
->
def
->
source
.
dir
);
}
else
{
if
((
src
=
strdup
(
pool
->
def
->
source
.
devices
[
0
].
path
))
==
NULL
)
{
virReportOOMError
(
conn
);
...
...
@@ -829,13 +828,11 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
vol
->
type
=
VIR_STORAGE_VOL_FILE
;
vol
->
target
.
format
=
VIR_STORAGE_VOL_FILE_RAW
;
/* Real value is filled in during probe */
if
(
VIR_ALLOC_N
(
vol
->
target
.
path
,
strlen
(
pool
->
def
->
target
.
path
)
+
1
+
strlen
(
vol
->
name
)
+
1
)
<
0
)
if
(
virAsprintf
(
&
vol
->
target
.
path
,
"%s/%s"
,
pool
->
def
->
target
.
path
,
vol
->
name
)
==
-
1
)
goto
no_memory
;
strcpy
(
vol
->
target
.
path
,
pool
->
def
->
target
.
path
);
strcat
(
vol
->
target
.
path
,
"/"
);
strcat
(
vol
->
target
.
path
,
vol
->
name
);
if
((
vol
->
key
=
strdup
(
vol
->
target
.
path
))
==
NULL
)
goto
no_memory
;
...
...
@@ -995,15 +992,15 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
virStorageVolDefPtr
vol
)
{
if
(
VIR_ALLOC_N
(
vol
->
target
.
path
,
strlen
(
pool
->
def
->
target
.
path
)
+
1
+
strlen
(
vol
->
name
)
+
1
)
<
0
)
{
vol
->
type
=
VIR_STORAGE_VOL_FILE
;
if
(
virAsprintf
(
&
vol
->
target
.
path
,
"%s/%s"
,
pool
->
def
->
target
.
path
,
vol
->
name
)
==
-
1
)
{
virReportOOMError
(
conn
);
return
-
1
;
}
vol
->
type
=
VIR_STORAGE_VOL_FILE
;
strcpy
(
vol
->
target
.
path
,
pool
->
def
->
target
.
path
);
strcat
(
vol
->
target
.
path
,
"/"
);
strcat
(
vol
->
target
.
path
,
vol
->
name
);
vol
->
key
=
strdup
(
vol
->
target
.
path
);
if
(
vol
->
key
==
NULL
)
{
virReportOOMError
(
conn
);
...
...
src/storage_backend_logical.c
浏览文件 @
adf43845
...
...
@@ -594,14 +594,13 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
/* A target path passed to CreateVol has no meaning */
VIR_FREE
(
vol
->
target
.
path
);
}
if
(
VIR_ALLOC_N
(
vol
->
target
.
path
,
strlen
(
pool
->
def
->
target
.
path
)
+
1
+
strlen
(
vol
->
name
)
+
1
)
<
0
)
{
if
(
virAsprintf
(
&
vol
->
target
.
path
,
"%s/%s"
,
pool
->
def
->
target
.
path
,
vol
->
name
)
==
-
1
)
{
virReportOOMError
(
conn
);
return
-
1
;
}
strcpy
(
vol
->
target
.
path
,
pool
->
def
->
target
.
path
);
strcat
(
vol
->
target
.
path
,
"/"
);
strcat
(
vol
->
target
.
path
,
vol
->
name
);
if
(
virRun
(
conn
,
cmdargv
,
NULL
)
<
0
)
return
-
1
;
...
...
src/test.c
浏览文件 @
adf43845
...
...
@@ -3110,16 +3110,13 @@ testStorageVolumeCreateXML(virStoragePoolPtr pool,
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
privvol
->
target
.
path
,
strlen
(
privpool
->
def
->
target
.
path
)
+
1
+
strlen
(
privvol
->
name
)
+
1
)
<
0
)
{
if
(
virAsprintf
(
&
privvol
->
target
.
path
,
"%s/%s"
,
privpool
->
def
->
target
.
path
,
privvol
->
name
)
==
-
1
)
{
virReportOOMError
(
pool
->
conn
);
goto
cleanup
;
}
strcpy
(
privvol
->
target
.
path
,
privpool
->
def
->
target
.
path
);
strcat
(
privvol
->
target
.
path
,
"/"
);
strcat
(
privvol
->
target
.
path
,
privvol
->
name
);
privvol
->
key
=
strdup
(
privvol
->
target
.
path
);
if
(
privvol
->
key
==
NULL
)
{
virReportOOMError
(
pool
->
conn
);
...
...
@@ -3204,16 +3201,13 @@ testStorageVolumeCreateXMLFrom(virStoragePoolPtr pool,
goto
cleanup
;
}
if
(
VIR_ALLOC_N
(
privvol
->
target
.
path
,
strlen
(
privpool
->
def
->
target
.
path
)
+
1
+
strlen
(
privvol
->
name
)
+
1
)
<
0
)
{
if
(
virAsprintf
(
&
privvol
->
target
.
path
,
"%s/%s"
,
privpool
->
def
->
target
.
path
,
privvol
->
name
)
==
-
1
)
{
virReportOOMError
(
pool
->
conn
);
goto
cleanup
;
}
strcpy
(
privvol
->
target
.
path
,
privpool
->
def
->
target
.
path
);
strcat
(
privvol
->
target
.
path
,
"/"
);
strcat
(
privvol
->
target
.
path
,
privvol
->
name
);
privvol
->
key
=
strdup
(
privvol
->
target
.
path
);
if
(
privvol
->
key
==
NULL
)
{
virReportOOMError
(
pool
->
conn
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录