mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Adapt to VIR_STRDUP and VIR_STRNDUP in tests/*
This commit is contained in:
@@ -13,6 +13,8 @@
|
||||
# include "vmx/vmx.h"
|
||||
# include "virstring.h"
|
||||
|
||||
# define VIR_FROM_THIS VIR_FROM_VMWARE
|
||||
|
||||
static virCapsPtr caps;
|
||||
static virDomainXMLOptionPtr xmlopt;
|
||||
static virVMXContext ctx;
|
||||
@@ -159,11 +161,8 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
|
||||
|
||||
if (STRPREFIX(fileName, "/vmfs/volumes/")) {
|
||||
/* Found absolute path referencing a file inside a datastore */
|
||||
copyOfFileName = strdup(fileName);
|
||||
|
||||
if (copyOfFileName == NULL) {
|
||||
if (VIR_STRDUP(copyOfFileName, fileName) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Expected format: '/vmfs/volumes/<datastore>/<path>' */
|
||||
if ((tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) == NULL ||
|
||||
@@ -177,7 +176,7 @@ testParseVMXFileName(const char *fileName, void *opaque ATTRIBUTE_UNUSED)
|
||||
goto cleanup;
|
||||
} else if (STRPREFIX(fileName, "/")) {
|
||||
/* Found absolute path referencing a file outside a datastore */
|
||||
src = strdup(fileName);
|
||||
ignore_value(VIR_STRDUP(src, fileName));
|
||||
} else if (strchr(fileName, '/') != NULL) {
|
||||
/* Found relative path, this is not supported */
|
||||
src = NULL;
|
||||
|
||||
Reference in New Issue
Block a user