Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs::copy() unix: set file mode early #58803

Merged
merged 1 commit into from
Mar 28, 2019
Merged

Commits on Mar 23, 2019

  1. 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: rust-lang#26933
    Fixed: rust-lang#37885
    haraldh committed Mar 23, 2019
    Configuration menu
    Copy the full SHA
    cf8347b View commit details
    Browse the repository at this point in the history