]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
dndUIX11.cpp::GetLastDirName() Remove a trailing slash in a directory pathname.
authorOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:34 +0000 (14:52 -0800)
committerOliver Kurth <okurth@vmware.com>
Fri, 22 Nov 2019 22:52:34 +0000 (14:52 -0800)
open-vm-tools/services/plugins/dndcp/dndUIX11.cpp

index e56a6f1f0ab1d2e8ef2810d87329f70e74bd6f1b..50c2bf5e1fddedfb46656e78f02f123f954faaaa 100644 (file)
@@ -1657,7 +1657,14 @@ std::string
 DnDUIX11::GetLastDirName(const std::string &str)
 {
    char *baseName;
-   File_GetPathName(str.c_str(), NULL, &baseName);
+   std::string stripSlash = str;
+   char *path = File_StripSlashes(stripSlash.c_str());
+   if (path) {
+      stripSlash = path;
+      free(path);
+   }
+
+   File_GetPathName(stripSlash.c_str(), NULL, &baseName);
    if (baseName) {
       std::string s(baseName);
       free(baseName);