From c2a3a00516fb600e5d2e9127119a703f33d2def2 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 9 Dec 2017 13:39:48 +0100 Subject: Linux: fix compilation error with older versions of gcc (e.g. 4.x) --- src/Platform/Unix/FilesystemPath.cpp | 6 +++--- 1 file 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 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); -- cgit v1.2.3