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).
This commit is contained in:
mckusick 2007-02-26 00:42:17 +00:00
parent f4f08cb037
commit 271ce58544

View File

@ -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]);