Re:C stdlib isn't threadsafe and even safe Rust didn't save us
by plorkyeran on Wednesday January 22, 2025 @06:28PM
(#42798641)
chdir is thread-safe, but interacting with the current directory in any context other than parsing command-line arguments is still nearly always a mistake. Everything past a program's entry point should be working exclusively in absolute paths.
[ Parent
| on HN ]
Re:C stdlib isn't threadsafe and even safe Rust didn't save us
by fanf2 on Wednesday January 22, 2025 @07:56PM
(#42799321)
Yeah if you chdir() in a multithreaded program, all cwd-relative file accesses in other threads are fucked.
As well as absolute paths, it’s ok to work with descriptor-relative paths using openat() and friends.