]> git.ipfire.org Git - thirdparty/zstd.git/commit
Use umask() to Constrain Created File Permissions 2495/head
authorW. Felix Handte <w@felixhandte.com>
Thu, 11 Feb 2021 20:50:13 +0000 (15:50 -0500)
committerW. Felix Handte <w@felixhandte.com>
Wed, 17 Feb 2021 20:27:39 +0000 (15:27 -0500)
commita774c5797399040af62db21d8a9b9769e005430e
tree88945f190ef041011c2f1d0df68c43cf68106ff4
parent8884cb887dca08ffd7dfbd59d53698c86c8e174b
Use umask() to Constrain Created File Permissions

This commit addresses #2491.

Note that a downside of this solution is that it is global: `umask()` affects
all file creation calls in the process. I believe this is safe since
`fileio.c` functions should only ever be used in the zstd binary, and these
are (almost) the only files ever created by zstd, and AIUI they're only
created in a single thread. So we can get away with messing with global state.

Note that this doesn't change the permissions of files created by `dibio.c`.
I'm not sure what those should be...
programs/fileio.c
programs/util.c
programs/util.h