mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 02:58:02 -06:00
Linux/macOS: use absolute path of 'true' command when checking if sudo session is active.
This commit is contained in:
@@ -314,7 +314,11 @@ namespace VeraCrypt
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user