- if (st.st_mode&S_IFDIR) {
- ecode = chownr(dp->d_name, st.st_uid, gid);
+ if (uid && uid != st.st_uid) {
+ ecode = error("You are not the owner of %s",
+ dp->d_name);
+ continue;
+ }
+ if ((st.st_mode & S_IFMT) == S_IFDIR) {
+ ecode = chownr(dp->d_name);