Skip to content

unix: Deprecate the POSIX-obsoleted tmpnam, tempnam - #5478

Merged
tgross35 merged 1 commit into
rust-lang:mainfrom
tgross35:deprecate-tmpnam
Sep 5, 2026
Merged

unix: Deprecate the POSIX-obsoleted tmpnam, tempnam#5478
tgross35 merged 1 commit into
rust-lang:mainfrom
tgross35:deprecate-tmpnam

Conversation

@tgross35

@tgross35 tgross35 commented Sep 5, 2026

Copy link
Copy Markdown
Member

tmpnam is TOCTOU-prone and not thread-safe if called with NULL, and has been marked obsolete by POSIX 1 and glibc 2. tempnam is also TOCTOU-prone and marked obsolete by POSIX 3, and glib docs say "Never use this function". We don't have these on all platforms, but mark them deprecated where they still exist.

Closes: #5211

`tmpnam` is TOCTOU-prone and not thread-safe if called with NULL, and
has been marked obsolete by POSIX [1] and glibc [2]. `tempnam` is also
TOCTOU-prone and marked obsolete by POSIX [3], and glib docs say "Never
use this function". We don't have these on all platforms, but mark them
deprecated where they still exist.

Closes: rust-lang#5211

[1]: https://pubs.opengroup.org/onlinepubs/9799919799/functions/tmpnam.html
[2]: https://man7.org/linux/man-pages/man3/tmpnam.3.html
[3]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tempnam.html
[4]: https://man7.org/linux/man-pages/man3/tempnam.3.html
@tgross35 tgross35 added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Sep 5, 2026
@tgross35
tgross35 enabled auto-merge September 5, 2026 08:29
@tgross35
tgross35 added this pull request to the merge queue Sep 5, 2026
Merged via the queue into rust-lang:main with commit 0f65977 Sep 5, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-unix stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate non-thread-safe tmpnam

2 participants