+int remove_default_tag_perm(const char* path,
+ acl_tag_t tag,
+ acl_perm_t perm) {
+ /* Attempt to remove perm from tag. Returns one if successful, zero
+ if there was nothing to do, and -1 on errors. */
+ int hdta = has_default_tag_acl(path, tag);
+ if (hdta != 1) {
+ /* Failure or error. */
+ return hdta;
+ }
+
+ acl_permset_t permset;
+ bool ps_result = get_default_tag_permset(path, tag, &permset);
+
+ if (ps_result != 1) {
+ /* Failure or error. */
+ return ps_result;
+ }
+
+ int d_result = acl_delete_perm(permset, perm);
+ if (d_result == -1) {
+ perror("remove_default_tag_perm (acl_delete_perm)");
+ return -1;
+ }
+
+ /* We've only removed perm from the permset; now we have to replace
+ the permset. */
+ acl_entry_t entry;
+ int entry_result = get_default_tag_entry(path, tag, &entry);
+
+ if (entry_result == -1) {
+ perror("remove_default_tag_perm (get_default_tag_entry)");
+ return -1;
+ }
+
+ if (entry_result == 1) {
+ /* Success. */
+ int s_result = acl_set_permset(entry, permset);
+ if (s_result == -1) {
+ perror("remove_default_tag_perm (acl_set_permset)");
+ return -1;
+ }
+
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+int remove_default_group_obj_execute(const char* path) {
+ return remove_default_tag_perm(path, ACL_GROUP_OBJ, ACL_EXECUTE);
+}
+
+