mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Linux: fix compilation error with older versions of gcc (e.g. 4.x)
This commit is contained in:
@@ -83,10 +83,10 @@ namespace VeraCrypt
|
||||
string linkPathName ("/sys/dev/block/");
|
||||
linkPathName += StringConverter::ToSingle (major (st.st_rdev)) + string (":") + StringConverter::ToSingle (minor (st.st_rdev));
|
||||
|
||||
char linkTargetPath[maxPathLength+1] = "";
|
||||
vector<char> linkTargetPath(maxPathLength+1);
|
||||
|
||||
if(readlink(linkPathName.c_str (), linkTargetPath, sizeof (linkTargetPath)) != -1) {
|
||||
const string targetPathStr (linkTargetPath);
|
||||
if(readlink(linkPathName.c_str (), linkTargetPath.data(), linkTargetPath.size()) != -1) {
|
||||
const string targetPathStr (linkTargetPath.data());
|
||||
const size_t lastSlashPos = targetPathStr.find_last_of ('/');
|
||||
const size_t secondLastSlashPos = targetPathStr.find_last_of ('/', lastSlashPos-1);
|
||||
path = string ("/dev/") + targetPathStr.substr (secondLastSlashPos+1, lastSlashPos-secondLastSlashPos-1);
|
||||
|
||||
Reference in New Issue
Block a user