Skip to content

[programs] set restrictive umask before file creation#1652

Closed
chungy wants to merge 1 commit intofacebook:devfrom
chungy:umask_new_files
Closed

[programs] set restrictive umask before file creation#1652
chungy wants to merge 1 commit intofacebook:devfrom
chungy:umask_new_files

Conversation

@chungy
Copy link
Contributor

@chungy chungy commented Jun 14, 2019

This resolves a condition where zstd or unzstd may expose read
permissions beyond what the original file allowed. umask 077
blocks out all permissions for group and other while the file
is being written to by zstd, and gets reset to the source file’s
mode afterward.

As suggested by @felixhandte in PR #1644, I think this solution is cleaner and removes the chance of reading the file before a chmod() call could be done. That PR should be closed if this one is accepted instead (one or the other).

This resolves a condition where zstd or unzstd may expose read
permissions beyond what the original file allowed.  umask 077
blocks out all permissions for group and other while the file
is being written to by zstd, and gets reset to the source file’s
mode afterward.

Fixes #1630
@chungy
Copy link
Contributor Author

chungy commented Jun 14, 2019

the chmod PR was pulled and one of the CI tests on this failed for some reason (the log doesn't tell me anything...). Closing. :)

@chungy chungy closed this Jun 14, 2019
@Cyan4973
Copy link
Contributor

The error was :

c:\projects\zstd-p0yf0\programs\fileio.c(539): warning C4996: 
'umask': The POSIX name for this item is deprecated. 
Instead, use the ISO C and C++ conformant name: _umask.

at https://ci.appveyor.com/project/YannCollet/zstd-p0yf0/builds/25271621/job/4j0mfu1kvn7317nt#L40.

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.

3 participants