diff options
| author | Harald Hoyer <harald@redhat.com> | 2019-02-28 10:25:54 +0100 |
|---|---|---|
| committer | Harald Hoyer <harald@hoyer.xyz> | 2019-03-23 07:36:27 +0100 |
| commit | cf8347ba6bc82c41de2ad9bf561af593a89cbe45 (patch) | |
| tree | 6dc37ee09025e41a85801b85f4764a8d11edcbaf /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 7cf074a1e655ac07d04d045667278fa1a9970b93 (diff) | |
| download | rust-cf8347ba6bc82c41de2ad9bf561af593a89cbe45.tar.gz rust-cf8347ba6bc82c41de2ad9bf561af593a89cbe45.zip | |
fs::copy() set file mode early
A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Use `fcopyfile` on MacOS instead of `copyfile`. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
