diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-12-09 13:39:48 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-12-09 15:11:48 +0100 |
commit | c2a3a00516fb600e5d2e9127119a703f33d2def2 (patch) | |
tree | d3947b1a5f62e25640367fc565898e4ff5c801c5 | |
parent | d03b06a40fd071832f791a150cab1c8b6a9d11d8 (diff) | |
download | VeraCrypt-c2a3a00516fb600e5d2e9127119a703f33d2def2.tar.gz VeraCrypt-c2a3a00516fb600e5d2e9127119a703f33d2def2.zip |
Linux: fix compilation error with older versions of gcc (e.g. 4.x)
-rw-r--r-- | src/Platform/Unix/FilesystemPath.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Platform/Unix/FilesystemPath.cpp b/src/Platform/Unix/FilesystemPath.cpp index 5841edf4..d6c9cd2b 100644 --- a/src/Platform/Unix/FilesystemPath.cpp +++ b/src/Platform/Unix/FilesystemPath.cpp @@ -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); |