diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-02-19 10:29:27 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-02-19 10:29:27 +0100 |
commit | fc7037b670fd55b9b199a5a1ee76f7bdee2bc816 (patch) | |
tree | 33e67c77edaaab5408d239f71f80b4bf148e87e0 /src | |
parent | 8574033ded3956c1530ea2da55d00834a6feb908 (diff) | |
download | VeraCrypt-master.tar.gz VeraCrypt-master.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/Core/Unix/CoreService.cpp | 6 |
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 @@ -312,11 +312,15 @@ namespace VeraCrypt string sudoAbsolutePath = Process::FindSystemBinary("sudo", errorMsg); if (sudoAbsolutePath.empty()) throw SystemException(SRC_POS, errorMsg); - 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 + string trueAbsolutePath = Process::FindSystemBinary("true", errorMsg); + if (trueAbsolutePath.empty()) + throw SystemException(SRC_POS, errorMsg); + + 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 FILE* pipe = popen(popenCommand.c_str(), "r"); if (pipe) { // We only care about the exit code char buf[128]; |