The acl_free() function will return ACL_ERROR and set errno to EINVAL
if we pass it a null pointer; but aside from that, nothing bad
happens, and removing the checks makes the code marginally cleaner.
cleanup:
free(dirname_path_copy);
free(basename_path_copy);
- if (new_acl != (acl_t)NULL) {
- acl_free(new_acl);
- }
- if (new_acl_unmasked != (acl_t)NULL) {
- acl_free(new_acl_unmasked);
- }
+ acl_free(new_acl);
+ acl_free(new_acl_unmasked);
+
if (fd > 0 && close(fd) == CLOSE_ERROR) {
perror("apply_default_acl_ex (close fd)");
result = ACL_ERROR;