From: Oliver Kurth Date: Fri, 22 Nov 2019 22:52:34 +0000 (-0800) Subject: dndUIX11.cpp::GetLastDirName() Remove a trailing slash in a directory pathname. X-Git-Tag: stable-11.1.0~138 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=383caa13e25f90cb4e9a392523fcd333b7ca6166;p=thirdparty%2Fopen-vm-tools.git dndUIX11.cpp::GetLastDirName() Remove a trailing slash in a directory pathname. --- diff --git a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp index e56a6f1f0..50c2bf5e1 100644 --- a/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp +++ b/open-vm-tools/services/plugins/dndcp/dndUIX11.cpp @@ -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);