From b5ea8f4cbc93db4672b3083617723e597a5b43f3 Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Mon, 26 Feb 2007 00:42:17 +0000 Subject: [PATCH] Implement the -h flag (set an ACL on a symbolic link). Before this fix the -h flag was ignored (i.e. setfacl always set the ACL on the file pointed to by the symbolic link even when the -h flag requested that the ACL be set on the symbolic link itself). --- bin/setfacl/setfacl.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bin/setfacl/setfacl.c b/bin/setfacl/setfacl.c index 43a55459e0b..b86dbb1eac7 100644 --- a/bin/setfacl/setfacl.c +++ b/bin/setfacl/setfacl.c @@ -253,10 +253,20 @@ main(int argc, char *argv[]) if (need_mask && (set_acl_mask(&final_acl) == -1)) { warnx("failed to set ACL mask on %s", file->filename); carried_error++; - } else if (acl_set_file(file->filename, acl_type, - final_acl) == -1) { - carried_error++; - warn("acl_set_file() failed for %s", file->filename); + } else if (h_flag) { + if (acl_set_link_np(file->filename, acl_type, + final_acl) == -1) { + carried_error++; + warn("acl_set_link_np() failed for %s", + file->filename); + } + } else { + if (acl_set_file(file->filename, acl_type, + final_acl) == -1) { + carried_error++; + warn("acl_set_file() failed for %s", + file->filename); + } } acl_free(acl[ACCESS_ACL]);