VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Core
diff options
context:
space:
mode:
authorJertzukka <Jertzukka@gmail.com>2024-06-03 09:09:54 +0300
committerGitHub <noreply@github.com>2024-06-03 08:09:54 +0200
commitbd1e7726573e1834e9954d3b30c9bc255c96a840 (patch)
tree58034c5988885500736ea4be6f96f07655a1b714 /src/Core
parent6ac3b02a24ac40e775772f1ea95603c17c5cbaf4 (diff)
downloadVeraCrypt-bd1e7726573e1834e9954d3b30c9bc255c96a840.tar.gz
VeraCrypt-bd1e7726573e1834e9954d3b30c9bc255c96a840.zip
FreeBSD: Fix privilege escalation prompts not showing up (#1349)
The behaviour of `wc -l` is different on FreeBSD, in which the stdout result is padded by spaces in the beginning, which causes that the result[0] is not actually the value we care about. This patch adds a translate removing all whitespace from the output.
Diffstat (limited to 'src/Core')
-rw-r--r--src/Core/Unix/CoreService.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Core/Unix/CoreService.cpp b/src/Core/Unix/CoreService.cpp
index e543652a..e3fca20e 100644
--- a/src/Core/Unix/CoreService.cpp
+++ b/src/Core/Unix/CoreService.cpp
@@ -309,7 +309,7 @@ namespace VeraCrypt
std::vector<char> buffer(128, 0);
std::string result;
- FILE* pipe = popen("sudo -n uptime 2>&1 | grep 'load average' | wc -l", "r"); // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
+ FILE* pipe = popen("sudo -n uptime 2>&1 | grep 'load average' | wc -l | tr -d '[:blank:]'", "r"); // We redirect stderr to stdout (2>&1) to be able to catch the result of the command
if (pipe)
{
while (!feof(pipe))