- basename of path here instead of the full thing, then we can get
- away with using openat() and spare ourselves the slowness of
- another safe_open(). */
- basename_path_copy = strdup(path);
- if (basename_path_copy == NULL) {
- perror("apply_default_acl (strdup)");
- result = ACL_ERROR;
- goto cleanup;
- }
-
- /* If the basename is ".", then we don't want to open "." relative
- to the parent_fd, so we need another special case for that
- path. */
- if (strcmp(path, ".") == 0 && strcmp(parent, ".") == 0) {
- fd = open(".", O_NOFOLLOW);
- }
- else if (strcmp(path, "..") == 0 && strcmp(parent, ".") == 0) {
- fd = open("..", O_NOFOLLOW);
+ * basename of path here instead of the full thing, then we can get
+ * away with using openat() and spare ourselves the slowness of
+ * another safe_open().
+ *
+ * Note that if the basename is "." or "..", then we don't want to
+ * open it relative to the parent_fd, so we need another special
+ * case for those paths here.
+ */
+ if (path_is_dots) {
+ fd = open(child, O_NOFOLLOW);