mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-06-10 14:57:02 -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;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(const CK_OBJECT_HANDLE & dataHandle: GetObjects(slotId, CKO_DATA))
|
foreach(const CK_OBJECT_HANDLE & dataHandle, GetObjects(slotId, CKO_DATA))
|
||||||
{
|
{
|
||||||
SecurityTokenKeyfile keyfile;
|
SecurityTokenKeyfile keyfile;
|
||||||
keyfile.Handle = dataHandle;
|
keyfile.Handle = dataHandle;
|
||||||
|
|||||||
@@ -1440,8 +1440,8 @@ namespace VeraCrypt
|
|||||||
while (getline(ss, token, ':'))
|
while (getline(ss, token, ':'))
|
||||||
{
|
{
|
||||||
// remove any trailing slashes from the token
|
// remove any trailing slashes from the token
|
||||||
while (!token.empty() && token.back() == '/')
|
while (!token.empty() && token[token.length() - 1] == '/')
|
||||||
token.pop_back();
|
token.erase(token.length() - 1);
|
||||||
|
|
||||||
if (token.empty())
|
if (token.empty())
|
||||||
continue;
|
continue;
|
||||||
@@ -1459,8 +1459,8 @@ namespace VeraCrypt
|
|||||||
free(resolvedEntry);
|
free(resolvedEntry);
|
||||||
|
|
||||||
// remove any trailing slashes from the token
|
// remove any trailing slashes from the token
|
||||||
while (!entryPath.empty() && entryPath.back() == '/')
|
while (!entryPath.empty() && entryPath[entryPath.length() - 1] == '/')
|
||||||
entryPath.pop_back();
|
entryPath.erase(entryPath.length() - 1);
|
||||||
|
|
||||||
// perform check again if the resolved path is different from the original (symlink)
|
// perform check again if the resolved path is different from the original (symlink)
|
||||||
if (dirPath == entryPath || dirPath.find(entryPath + "/") == 0)
|
if (dirPath == entryPath || dirPath.find(entryPath + "/") == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user