From 124e431e677f5ed3c45f71105a6770ceb96199dd Mon Sep 17 00:00:00 2001 From: Andreas Gruenbacher Date: Mon, 13 Apr 2015 11:56:05 +0200 Subject: [PATCH 24/34] libacl: acl_set_file: Remove unnecesary racy check Only directories can have default acls. This is checked in the kernel, and unnecessarily also in acl_set_file. There is a window between checking the file type and setting the acl, so the check in acl_set_file isn't even safe. Remove it. Reported by Lennart Poettering . --- libacl/acl_set_file.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/libacl/acl_set_file.c b/libacl/acl_set_file.c index 6821851..a7e368f 100644 --- a/libacl/acl_set_file.c +++ b/libacl/acl_set_file.c @@ -54,19 +54,6 @@ acl_set_file(const char *path_p, acl_type_t type, acl_t acl) return -1; } - if (type == ACL_TYPE_DEFAULT) { - struct stat st; - - if (stat(path_p, &st) != 0) - return -1; - - /* Only directories may have default ACLs. */ - if (!S_ISDIR(st.st_mode)) { - errno = EACCES; - return -1; - } - } - ext_acl_p = __acl_to_xattr(acl_obj_p, &size); if (!ext_acl_p) return -1; -- 2.5.2