VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-19 10:29:27 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2025-02-19 10:29:27 +0100
commitfc7037b670fd55b9b199a5a1ee76f7bdee2bc816 (patch)
tree33e67c77edaaab5408d239f71f80b4bf148e87e0 /src
parent8574033ded3956c1530ea2da55d00834a6feb908 (diff)
downloadVeraCrypt-fc7037b670fd55b9b199a5a1ee76f7bdee2bc816.tar.gz
VeraCrypt-fc7037b670fd55b9b199a5a1ee76f7bdee2bc816.zip
Linux/macOS: use absolute path of 'true' command when checking if sudo session is active.
Diffstat (limited to 'src')
-rw-r--r--src/Core/Unix/CoreService.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index dc2f4e6b..9531069a 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -314,7 +314,11 @@ namespace VeraCrypt
314 if (sudoAbsolutePath.empty()) 314 if (sudoAbsolutePath.empty())
315 throw SystemException(SRC_POS, errorMsg); 315 throw SystemException(SRC_POS, errorMsg);
316 316
317 std::string popenCommand = sudoAbsolutePath + " -n true > /dev/null 2>&1"; // We redirect stderr to stdout (2>&1) to be able to catch the result of the command 317 string trueAbsolutePath = Process::FindSystemBinary("true", errorMsg);
318 if (trueAbsolutePath.empty())
319 throw SystemException(SRC_POS, errorMsg);
320
321 std::string popenCommand = sudoAbsolutePath + " -n " + trueAbsolutePath + " > /dev/null 2>&1"; // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
318 FILE* pipe = popen(popenCommand.c_str(), "r"); 322 FILE* pipe = popen(popenCommand.c_str(), "r");
319 if (pipe) 323 if (pipe)
320 { 324 {