diff options
-rw-r--r-- | pw/rm_r.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -71,5 +71,8 @@ rm_r(int rootfd, const char *path, uid_t uid) closedir(d); if (fstatat(rootfd, path, &st, AT_SYMLINK_NOFOLLOW) != 0) return; - unlinkat(rootfd, path, S_ISDIR(st.st_mode) ? AT_REMOVEDIR : 0); + if (S_ISLNK(st.st_mode)) + unlinkat(rootfd, path, 0); + else if (st.st_uid == uid) + unlinkat(rootfd, path, AT_REMOVEDIR); } |