1
0
Fork 0

Fix windows path handling not to slip into UNC lookup (#10073)

* make sure that we don't get more than one leading directory separator in front of the path, so windows doesn't mistakenly look it up as a UNC.
This commit is contained in:
Wilfried Goesgens 2019-09-25 10:23:04 +02:00 committed by Frank Celler
parent ca3c742652
commit 61cbff5e2e
2 changed files with 15 additions and 3 deletions

View File

@ -1,6 +1,8 @@
devel
-----
* Fix config directory handling, so we don't trap into UNC path lookups on windows
* Prevent spurious log message "Scheduler queue is filled more than 50% in last x s"
from occurring when this is not the case. Due to a data race, the message could
previously also occur if the queue was empty.

View File

@ -2441,7 +2441,11 @@ int TRI_GetTempName(char const* directory, std::string& result, bool createFile,
std::string TRI_LocateInstallDirectory(char const* argv0, char const* binaryPath) {
std::string thisPath = TRI_LocateBinaryPath(argv0);
return TRI_GetInstallRoot(thisPath, binaryPath) + TRI_DIR_SEPARATOR_CHAR;
std::string ret = TRI_GetInstallRoot(thisPath, binaryPath);
if (ret.length() != 1 || ret != TRI_DIR_SEPARATOR_STR) {
ret += TRI_DIR_SEPARATOR_CHAR;
}
return ret;
}
////////////////////////////////////////////////////////////////////////////////
@ -2460,8 +2464,14 @@ std::string TRI_LocateConfigDirectory(char const* binaryPath) {
}
std::string r = TRI_LocateInstallDirectory(nullptr, binaryPath);
r += _SYSCONFDIR_;
std::string scDir = _SYSCONFDIR_;
if (r.length() == 1 &&
r == TRI_DIR_SEPARATOR_STR &&
scDir[0] == TRI_DIR_SEPARATOR_CHAR) {
r = scDir;
} else {
r += _SYSCONFDIR_;
}
r += std::string(1, TRI_DIR_SEPARATOR_CHAR);
return r;