Set a directory to owner-only access (`0o700`) on Unix. No-op on non-Unix platforms.
(path: &Path)
| 79 | /// |
| 80 | /// No-op on non-Unix platforms. |
| 81 | pub fn set_dir_owner_only(path: &Path) -> Result<()> { |
| 82 | #[cfg(unix)] |
| 83 | { |
| 84 | use std::os::unix::fs::PermissionsExt; |
| 85 | std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o700)) |
| 86 | .into_diagnostic() |
| 87 | .wrap_err_with(|| format!("failed to set permissions on {}", path.display()))?; |
| 88 | } |
| 89 | #[cfg(not(unix))] |
| 90 | let _ = path; |
| 91 | Ok(()) |
| 92 | } |
| 93 | |
| 94 | /// Set a file to owner-only read/write (`0o600`) on Unix. |
| 95 | /// |
no outgoing calls
no test coverage detected