about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-03-28 08:43:29 +0100
committerGitHub <noreply@github.com>2019-03-28 08:43:29 +0100
commit83d91d3ac4981cd6e987f2c066f9bb8b08525737 (patch)
treec3ce68b5a8a13f1a47b632c78525de9e2238318e /src/libstd/sys/unix/stack_overflow.rs
parent5a90b66de32bdd5320e5b98ca954059f9e19fec6 (diff)
parentcf8347ba6bc82c41de2ad9bf561af593a89cbe45 (diff)
downloadrust-83d91d3ac4981cd6e987f2c066f9bb8b08525737.tar.gz
rust-83d91d3ac4981cd6e987f2c066f9bb8b08525737.zip
Rollup merge of #58803 - haraldh:fs_copy_fix, r=alexcrichton
fs::copy() unix: 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.

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