}
}
-int
-vmwareParsePath(char *path, char **directory, char **filename)
+static int
+vmwareParsePath(const char *path, char **directory, char **filename)
{
char *separator;
separator = strrchr(path, '/');
if (separator != NULL) {
- *separator++ = '\0';
+ separator++;
if (*separator == '\0') {
virReportError(VIR_ERR_INTERNAL_ERROR,
return -1;
}
- if (VIR_STRDUP(*directory, path) < 0)
+ if (VIR_STRNDUP(*directory, path, separator - path - 1) < 0)
goto error;
if (VIR_STRDUP(*filename, separator) < 0) {
VIR_FREE(*directory);
/*---------------------------------------------------------------------------*/
-/* Copyright 2010, diateam (www.diateam.net)
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ * Copyright 2010, diateam (www.diateam.net)
* Copyright (c) 2013, Doug Goldstein (cardoe@cardoe.com)
*
* This library is free software; you can redistribute it and/or
int vmwareDomainConfigDisplay(vmwareDomainPtr domain, virDomainDefPtr vmdef);
-int vmwareParsePath(char *path, char **directory, char **filename);
-
int vmwareConstructVmxPath(char *directoryName, char *name,
char **vmxPath);