diff --git a/src/chown/Cargo.toml b/src/chown/Cargo.toml index e34abc72f..a17692dc1 100644 --- a/src/chown/Cargo.toml +++ b/src/chown/Cargo.toml @@ -14,6 +14,13 @@ libc = "*" uucore = { path="../uucore" } walkdir = "0.1" +[dependencies.clippy] +version = "*" +optional = true + +[features] +default = [] + [[bin]] name = "chown" path = "main.rs" diff --git a/src/chown/chown.rs b/src/chown/chown.rs index 42b53813f..79ff80b4e 100644 --- a/src/chown/chown.rs +++ b/src/chown/chown.rs @@ -8,6 +8,9 @@ // file that was distributed with this source code. // +#![cfg_attr(feature="clippy", feature(plugin))] +#![cfg_attr(feature="clippy", plugin(clippy))] + extern crate libc; use libc::{uid_t, gid_t, c_char, c_int}; @@ -336,7 +339,7 @@ impl Chowner { fn dive_into>(&self, root: P) -> i32 { let mut ret = 0; let root = root.as_ref(); - let follow = self.bit_flag & FTS_LOGICAL != 0; + let follow = self.dereference || self.bit_flag & FTS_LOGICAL != 0; for entry in WalkDir::new(root).follow_links(follow).min_depth(1) { let entry = unwrap!(entry, e, { ret = 1; @@ -356,7 +359,7 @@ impl Chowner { continue; } - ret = self.wrap_chown(path, &meta, true); + ret = self.wrap_chown(path, &meta, follow); } ret }