diff --git a/swift/extractor/infra/file/TargetFile.cpp b/swift/extractor/infra/file/TargetFile.cpp index 4ce4c8ae23be..84e6d44ec376 100644 --- a/swift/extractor/infra/file/TargetFile.cpp +++ b/swift/extractor/infra/file/TargetFile.cpp @@ -50,9 +50,10 @@ bool TargetFile::init() { checkOutput("open"); return true; } - CODEQL_ASSERT(errno == EEXIST, "Unable to open {} for writing ({})", targetPath, + CODEQL_EXPECT(errno == EEXIST, "Unable to open {} for writing ({})", targetPath, currentErrorCode()); - // else the file already exists and we just lost the race + // else the file already exists and we just lost the race, or some error occurred + // and the file could not be created return false; }