From 271ce5854460a9894cb8c86e2850044b8c5bd432 Mon Sep 17 00:00:00 2001 From: mckusick Date: Mon, 26 Feb 2007 00:42:17 +0000 Subject: 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(-) (limited to 'bin/setfacl') diff --git a/bin/setfacl/setfacl.c b/bin/setfacl/setfacl.c index 43a5545..b86dbb1 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]); -- cgit v1.1