Skip to content

Commit c571671

Browse files
mikdusanandrewrk
authored andcommitted
stage1: fix lost argv[0]
- bug presented on FreeBSD when `/proc` filesystem is not mounted - bogus `cc` was used as exename, causing incorrect executable spawn - llvm::sys::fs::getMainExecutable() has platform-specific code to get exename and fallback is to use param argv0 - linux fallback is rare because `/proc` is usually mounted - *BSD fallback is not rare because `/proc` is often not mounted - macOS doesn't ever fallback: bug cannot present - windows doesn't ever fallback: bug cannot present - other Posix will always present
1 parent a11c20e commit c571671

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/zig_clang_driver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ int ZigClang_main(int argc_, const char **argv_) {
421421
ApplyQAOverride(argv, OverrideStr, SavedStrings);
422422
}
423423

424-
std::string Path = GetExecutablePath(argv[0], CanonicalPrefixes);
424+
std::string Path = GetExecutablePath(argv_[0], CanonicalPrefixes);
425425

426426
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts =
427427
CreateAndPopulateDiagOpts(argv);

0 commit comments

Comments
 (0)