--- chmod.c 2007-07-07 00:21:07.000000000 +0200 +++ chmod.c 2009-03-23 08:53:27.000000000 +0100 @@ -385,7 +385,7 @@ #ifdef __APPLE__ /* If an ACL manipulation option was specified, manipulate */ if (acloptflags & ACL_FLAG) { - if (0 != modify_file_acl(acloptflags, p->fts_accpath, acl_input, aclpos, inheritance_level)) + if (0 != modify_file_acl(acloptflags, p->fts_accpath, acl_input, aclpos, inheritance_level, !hflag)) rval = 1; } else { --- chmod_acl.c 2007-06-08 01:12:18.000000000 +0200 +++ chmod_acl.c 2009-03-23 08:53:52.000000000 +0100 @@ -668,7 +668,7 @@ } int -modify_file_acl(unsigned int optflags, const char *path, acl_t modifier, int position, int inheritance_level) { +modify_file_acl(unsigned int optflags, const char *path, acl_t modifier, int position, int inheritance_level, int follow) { acl_t oacl = NULL; unsigned aindex = 0, flag_new_acl = 0; @@ -803,9 +803,18 @@ * "changeset" mechanism, common locking strategy, or kernel * supplied reservation mechanism to prevent this race. */ - if (!(optflags & (ACL_TO_STDOUT|ACL_CHECK_CANONICITY)) && - (0 != acl_set_file(path, ACL_TYPE_EXTENDED, oacl))){ - if (!fflag) + if (!(optflags & (ACL_TO_STDOUT|ACL_CHECK_CANONICITY))) { + int status = -1; + if (follow) { + status = acl_set_file(path, ACL_TYPE_EXTENDED, oacl); + } else { + int fd = open(path, O_SYMLINK); + if (fd != -1) { + status = acl_set_fd_np(fd, oacl, ACL_TYPE_EXTENDED); + close(fd); + } + } + if (status != 0 && !fflag) warn("Failed to set ACL on file '%s'", path); retval = 1; } --- chmod_acl.h 2007-06-08 01:12:18.000000000 +0200 +++ chmod_acl.h 2009-03-23 08:53:27.000000000 +0100 @@ -80,6 +80,6 @@ extern unsigned find_canonical_position(acl_t acl, acl_entry_t modifier); extern int subtract_from_entry(acl_entry_t rentry, acl_entry_t modifier); extern int modify_acl(acl_t *oaclp, acl_entry_t modifier, unsigned int optflags, int position, int inheritance_level, unsigned flag_new_acl); -extern int modify_file_acl(unsigned int optflags, const char *path, acl_t modifier, int position, int inheritance_level); +extern int modify_file_acl(unsigned int optflags, const char *path, acl_t modifier, int position, int inheritance_level, int follow); extern uuid_t *name_to_uuid(char *tok, int nametype); #endif /* __APPLE__*/