1
0
Fork 0

Init leaked stale launch state and rejected cwd-relative paths (Codex review)

This commit is contained in:
3rdit 2026-04-16 02:19:49 +01:00
parent 0ed945af36
commit 7ec6c02cb5
No known key found for this signature in database
GPG Key ID: 7DD8A35AE190E434
1 changed files with 6 additions and 2 deletions

View File

@ -24,10 +24,15 @@ namespace ElfBug
bool Debugger::Init(const char* szFilePath, const char* const* argv, const char* szCurrentDirectory)
{
mHasLaunchArgs = false;
mFilePath.clear();
mArgv.clear();
mCwd.clear();
if(!szFilePath)
return false;
if(access(szFilePath, X_OK) != 0)
if(!szCurrentDirectory && access(szFilePath, X_OK) != 0)
{
cbInternalError("cannot execute '" + std::string(szFilePath) + "': " + std::string(strerror(errno)));
return false;
@ -35,7 +40,6 @@ namespace ElfBug
mFilePath = szFilePath;
mCwd = szCurrentDirectory ? szCurrentDirectory : "";
mArgv.clear();
if(argv)
{
for(const char* const* p = argv; *p != nullptr; ++p)