Adapt to VIR_STRDUP and VIR_STRNDUP in tests/*

This commit is contained in:
Michal Privoznik
2013-05-03 14:52:21 +02:00
parent aaf8114d56
commit e60b9783e1
16 changed files with 71 additions and 67 deletions

View File

@@ -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;