Skip to content

Use umask() to Constrain Created File Permissions#2495

Merged
felixhandte merged 1 commit intofacebook:devfrom
felixhandte:umask
Feb 17, 2021
Merged

Use umask() to Constrain Created File Permissions#2495
felixhandte merged 1 commit intofacebook:devfrom
felixhandte:umask

Conversation

@felixhandte
Copy link
Contributor

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...

This commit addresses facebook#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...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants