Skip to main content

parse_mode_check_umask

Function parse_mode_check_umask 

Source
pub fn parse_mode_check_umask(
    mode_str: &str,
    current_mode: u32,
) -> Result<(u32, bool), String>
Expand description

Parse a mode and also compute whether the umask blocked any requested bits. Returns (new_mode, umask_blocked) where umask_blocked is true if the umask prevented some requested bits from being changed.

This is needed for GNU compatibility: when no who is specified (e.g. -rwx instead of a-rwx), umask filters the operation. If the resulting mode differs from what would have been achieved without the umask, GNU warns and exits 1 (but only when the mode was passed as an option-like arg).