Fix build: rename GetLastError to avoid Win32 collision, fix strprintf varargs

- Rename CTorProcess::GetLastError() and CTorEmbedded::GetLastError() to
  GetStartupError() so they don't shadow the Win32 GetLastError() API,
  which caused a std::string-to-DWORD conversion error on Windows.
- Qualify the one Win32 call as ::GetLastError() for clarity.
- Pass torError.c_str() to strprintf instead of std::string, fixing
  Clang's -Wnon-pod-varargs error on macOS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 20:34:37 -07:00
parent f5c0f53377
commit d10ca379a7
5 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -314,7 +314,7 @@ bool CTorProcess::Start(const std::string& dataDir, int socks, int hsPort, bool
NULL, NULL,
&si, &pi))
{
DWORD err = GetLastError();
DWORD err = ::GetLastError();
lastError = strprintf("CreateProcess failed for Tor binary '%s' with Windows error %lu", torBinaryPath.c_str(), err);
printf("ERROR: Failed to start Tor process (error %lu)\n", err);
return false;