fixed false positive file leaking on C/C++ for debian #1

Merged
dalmurii merged 1 commit from watta0/aclspv:master into master 2026-05-05 17:17:16 +00:00
Contributor

This change refactors the SPIR-V output file handling code by replacing
C-style FILE* (fopen/fwrite/fclose) with std::ofstream.

The original change was motivated by a suspected file descriptor leak on
Debian. However, further investigation showed that this was a false positive,
and the existing implementation was already correctly closing the file.

Despite that, RAII-based resource management has been introduced via
std::ofstream to eliminate any potential for such false positives and to
ensure automatic and exception-safe file handling.

Key changes:

Replaced fopen/fwrite/fclose with std::ofstream
Added explicit is_open() check before writing
Kept existing control flow (including fallback label) unchanged

There is no intended functional change.

This change refactors the SPIR-V output file handling code by replacing C-style FILE* (fopen/fwrite/fclose) with std::ofstream. The original change was motivated by a suspected file descriptor leak on Debian. However, further investigation showed that this was a false positive, and the existing implementation was already correctly closing the file. Despite that, RAII-based resource management has been introduced via std::ofstream to eliminate any potential for such false positives and to ensure automatic and exception-safe file handling. Key changes: Replaced fopen/fwrite/fclose with std::ofstream Added explicit is_open() check before writing Kept existing control flow (including fallback label) unchanged There is no intended functional change.
Owner

Quite many indentations has been changed but ignorable.
Refactoured code looks solid as explicit.

I approve.

Quite many indentations has been changed but ignorable. Refactoured code looks solid as explicit. I approve.
dalmurii merged commit 2ec3f9d2a7 into master 2026-05-05 17:17:16 +00:00
Sign in to join this conversation.
No description provided.