mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-09 22:36:59 -05:00
Linux: fix CentOS 6 build with GCC 4.4
CentOS 6 builds VeraCrypt with GCC 4.4.7 and -std=c++0x. That compiler does not support range-based for loops, and its libstdc++ does not provide std::string::back() or std::string::pop_back(). Avoid those constructs in the affected Unix/Linux code paths: use VeraCrypt's existing foreach helper when iterating PKCS#11 object handles, and use indexing plus erase() when trimming trailing slashes from PATH entries. This keeps the code valid for newer Linux toolchains while restoring compatibility with the CentOS 6 build environment.
This commit is contained in:
@@ -220,7 +220,7 @@ namespace VeraCrypt
|
||||
throw;
|
||||
}
|
||||
|
||||
for(const CK_OBJECT_HANDLE & dataHandle: GetObjects(slotId, CKO_DATA))
|
||||
foreach(const CK_OBJECT_HANDLE & dataHandle, GetObjects(slotId, CKO_DATA))
|
||||
{
|
||||
SecurityTokenKeyfile keyfile;
|
||||
keyfile.Handle = dataHandle;
|
||||
|
||||
@@ -1440,8 +1440,8 @@ namespace VeraCrypt
|
||||
while (getline(ss, token, ':'))
|
||||
{
|
||||
// remove any trailing slashes from the token
|
||||
while (!token.empty() && token.back() == '/')
|
||||
token.pop_back();
|
||||
while (!token.empty() && token[token.length() - 1] == '/')
|
||||
token.erase(token.length() - 1);
|
||||
|
||||
if (token.empty())
|
||||
continue;
|
||||
@@ -1459,8 +1459,8 @@ namespace VeraCrypt
|
||||
free(resolvedEntry);
|
||||
|
||||
// remove any trailing slashes from the token
|
||||
while (!entryPath.empty() && entryPath.back() == '/')
|
||||
entryPath.pop_back();
|
||||
while (!entryPath.empty() && entryPath[entryPath.length() - 1] == '/')
|
||||
entryPath.erase(entryPath.length() - 1);
|
||||
|
||||
// perform check again if the resolved path is different from the original (symlink)
|
||||
if (dirPath == entryPath || dirPath.find(entryPath + "/") == 0)
|
||||
|
||||
Reference in New Issue
Block a user