提交 d0a8f99c 编写于 作者: M Matthias Bolte

esx: Remove dead store in esxUtil_ParseDatastorePath

The ++ on preliminaryFileName was a left over from a previous version
of this function that explicitly returned the filename and did a strdup
on preliminaryFileName afterwards.

As the filename isn't returned explicitly anymore remove the preliminary
variable for it and reuse the tmp variable instead.

Reported by Eric Blake, detected by clang.
上级 29e131de
......@@ -3,7 +3,7 @@
* esx_util.c: utility functions for the VMware ESX driver
*
* Copyright (C) 2010 Red Hat, Inc.
* Copyright (C) 2009 Matthias Bolte <matthias.bolte@googlemail.com>
* Copyright (C) 2009-2011 Matthias Bolte <matthias.bolte@googlemail.com>
* Copyright (C) 2009 Maximilian Wilhelm <max@rfc2324.org>
*
* This library is free software; you can redistribute it and/or
......@@ -284,7 +284,6 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
char *saveptr = NULL;
char *preliminaryDatastoreName = NULL;
char *preliminaryDirectoryAndFileName = NULL;
char *preliminaryFileName = NULL;
if ((datastoreName != NULL && *datastoreName != NULL) ||
(directoryName != NULL && *directoryName != NULL) ||
......@@ -328,11 +327,11 @@ esxUtil_ParseDatastorePath(const char *datastorePath, char **datastoreName,
}
if (directoryName != NULL) {
/* Split <path> into <directory>/<file> */
preliminaryFileName = strrchr(preliminaryDirectoryAndFileName, '/');
/* Split <path> into <directory>/<file> and remove /<file> */
tmp = strrchr(preliminaryDirectoryAndFileName, '/');
if (preliminaryFileName != NULL) {
*preliminaryFileName++ = '\0';
if (tmp != NULL) {
*tmp = '\0';
}
if (esxVI_String_DeepCopyValue(directoryName,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册