aboutsummaryrefslogtreecommitdiffstats
path: root/src/scratch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/scratch.rs')
-rw-r--r--src/scratch.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/scratch.rs b/src/scratch.rs
index dddd91b..8d469c3 100644
--- a/src/scratch.rs
+++ b/src/scratch.rs
@@ -63,7 +63,11 @@ pub fn set_modes(dir: &Path, mode: u32) -> Result<()> {
std::fs::set_permissions(dir, reach).with_context(|| format!("chmod {}", dir.display()))?;
for entry in std::fs::read_dir(dir)? {
let entry = entry?;
- if entry.file_type()?.is_dir() {
+ let kind = entry.file_type()?;
+ if kind.is_symlink() {
+ // A link's own mode means nothing, and following it would change its target.
+ continue;
+ } else if kind.is_dir() {
set_modes(&entry.path(), mode)?;
} else {
std::fs::set_permissions(entry.path(), std::fs::Permissions::from_mode(mode))?;