return 1;
}
+
+int inode_type_can_acl(mode_t mode) {
+ return IN_SET(mode & S_IFMT, S_IFSOCK, S_IFREG, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO);
+}
}
#endif
+
+int inode_type_can_acl(mode_t mode);
assert(st);
/* ACLs are not supported on symlinks, there's no point in trying */
- if (S_ISLNK(st->st_mode))
+ if (!inode_type_can_acl(st->st_mode))
return 0;
r = get_acl(fd, name, ACL_TYPE_ACCESS, &acl);
"Refusing to set ACLs on hardlinked file %s while the fs.protected_hardlinks sysctl is turned off.",
path);
- if (S_ISLNK(st->st_mode)) {
- log_debug("Skipping ACL fix for symlink %s.", path);
+ if (!inode_type_can_acl(st->st_mode)) {
+ log_debug("Skipping ACL fix for '%s' (inode type does not support ACLs).", path);
return 0;
}