SIGN IN SIGN UP

[3.14] gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011) (#143080)

gh-143010: Prevent a TOCTOU issue by only calling open once (GH-143011)

RDM: per  AZero13's research the 'x' option did not exist when this code was written,  This
modernization can thus drop the fd trick in _create_carefully and just use open with 'x' to achieve the same goal more securely.
(cherry picked from commit a88d1b8dab4cbd3180dd7f1acb44d627db90323b)

Co-authored-by: AZero13 <gfunni234@gmail.com>
Co-authored-by: sobolevn <mail@sobolevn.me>
M
Miss Islington (bot) committed
33c9ebe437064ae5066767128e94c2fc9e388a50
Parent: 98f6db7
Committed by GitHub <noreply@github.com> on 12/22/2025, 6:14:59 PM