On Sun, Sep 7, 2025 at 6:26 PM Collin Funk <collin.fu...@gmail.com> wrote: > > Interesting, thanks for the report. Can't we just do the following to > avoid the extra umask() call? >
> - mode_t umask_value = umask (~mode); > + mode_t umask_value = umask (~mode & (S_IRWXU | S_IRWXG | S_IRWXO)); This seems likely fine, but after reading the POSIX description[1], I was worried that in the case that the other bits do serve some implementation-defined purpose it may not be correct to clear them, so went the route of only clearing the bits we need to. I'm not aware of any platform where that would actually matter though. [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/umask.html