]> gitweb.michael.orlitzky.com - apply-default-acl.git/blobdiff - src/libadacl.c
src/libadacl.c: add a special case for the path ".." as an argument.
[apply-default-acl.git] / src / libadacl.c
index a43afa5c1b203a63e7d905296a56719fa0a43d49..911e69ae3022736eab1f30e1e463b7bd18188e73 100644 (file)
@@ -1016,6 +1016,9 @@ int apply_default_acl(const char* path, bool recursive) {
   if (strcmp(path, ".") == 0 && strcmp(parent, ".") == 0) {
     parent_fd = safe_open("..", O_DIRECTORY | O_NOFOLLOW);
   }
+  else if (strcmp(path, "..") == 0 && strcmp(parent, ".") == 0) {
+    parent_fd = safe_open("../..", O_DIRECTORY | O_NOFOLLOW);
+  }
   else {
     parent_fd = safe_open(parent, O_DIRECTORY | O_NOFOLLOW);
   }
@@ -1050,6 +1053,9 @@ int apply_default_acl(const char* path, bool recursive) {
   if (strcmp(path, ".") == 0 && strcmp(parent, ".") == 0) {
     fd = open(".", O_NOFOLLOW);
   }
+  else if (strcmp(path, "..") == 0 && strcmp(parent, ".") == 0) {
+    fd = open("..", O_NOFOLLOW);
+  }
   else {
     fd = openat(parent_fd, basename(basename_path_copy), O_NOFOLLOW);
   }