diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-20 13:49:31 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2025-01-20 13:49:31 +0100 |
commit | c17270fc53453913d61d52bbd8fc41c83498db51 (patch) | |
tree | 62f62a475d81513196e8170ffc23c185c77b55f3 /src/Platform/Unix/Process.cpp | |
parent | b187afb4c8de8e4546f4aa96c328e61a86d144ca (diff) | |
download | VeraCrypt-c17270fc53453913d61d52bbd8fc41c83498db51.tar.gz VeraCrypt-c17270fc53453913d61d52bbd8fc41c83498db51.zip |
MacOSX: Fix erroneous preprocessor directive
Diffstat (limited to 'src/Platform/Unix/Process.cpp')
-rw-r--r-- | src/Platform/Unix/Process.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp index 0c2a9c59..395d4bc9 100644 --- a/src/Platform/Unix/Process.cpp +++ b/src/Platform/Unix/Process.cpp @@ -30,43 +30,43 @@ namespace VeraCrypt bool Process::IsExecutable(const std::string& path) { struct stat sb; if (stat(path.c_str(), &sb) == 0) { return S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)); } return false; } // Find executable in system paths std::string Process::FindSystemBinary(const char* name, std::string& errorMsg) { if (!name) { errno = EINVAL; // Invalid argument errorMsg = "Invalid input: name or paths is NULL"; return ""; } // Default system directories to search for executables #ifdef TC_MACOSX const char* defaultDirs[] = {"/usr/local/bin", "/usr/bin", "/bin", "/user/sbin", "/sbin"}; -#elseif TC_FREEBSD +#elif TC_FREEBSD const char* defaultDirs[] = {"/sbin", "/bin", "/usr/sbin", "/usr/bin", "/usr/local/sbin", "/usr/local/bin"}; -#elseif TC_OPENBSD +#elif TC_OPENBSD const char* defaultDirs[] = {"/sbin", "/bin", "/usr/sbin", "/usr/bin", "/usr/X11R6/bin", "/usr/local/sbin", "/usr/local/bin"}; #else const char* defaultDirs[] = {"/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin"}; #endif const size_t defaultDirCount = sizeof(defaultDirs) / sizeof(defaultDirs[0]); std::string currentPath(name); // If path doesn't start with '/', prepend default directories if (currentPath[0] != '/') { for (size_t i = 0; i < defaultDirCount; ++i) { std::string combinedPath = std::string(defaultDirs[i]) + "/" + currentPath; if (IsExecutable(combinedPath)) { return combinedPath; } } } else if (IsExecutable(currentPath)) { return currentPath; } |