stdio: implement tmpnam() and tempnam() functions#478
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the tmpnam and tempnam functions, moving the implementation to stdlib/mktemp.c and updating include/stdio.h with the required macro and prototype. The review identified several critical issues: a buffer overflow in tempnam when the prefix is null, broken retry logic in both functions because the template string is modified in place, a memory leak in tempnam when it fails to generate a name, and a lack of POSIX-compliant checks for the TMPDIR environment variable.
YT: RTOS-1333
Unit Test Results10 590 tests 9 910 ✅ 57m 13s ⏱️ For more details on these failures, see this check. Results for commit b3e65de. ♻️ This comment has been updated with latest results. |
|
Drafting for now as added tests depend on tmpfile() tests, which depend on tmpfile() fixes. Will undraft after phoenix-rtos/phoenix-rtos-posixsrv#32 is merged. |
|
if you would use the same branch name for related changes across all submodules, these changes would compile and test succesfully. PLEASE always use the same branch name on related changes OR use |
it's not this here: as I wrote, I'm fixing tmpfile() in another branch and wanted to base tests for this PR on that branch for now as it adds "posixsrv" directory to tests, which I didn't want to duplicate across PRs. I'll undraft, rerun tests and add reviewers once that PR is merged. |
YT: RTOS-1333
472358f to
b3e65de
Compare
Description
Motivation and Context
Types of changes
How Has This Been Tested?
Checklist:
Special treatment