From 1ad6e96c6b6d1ac60ce3f5e39e674d157fae53ad Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 17 Jun 2018 20:57:24 -0400 Subject: [PATCH] src/libadacl.c: add a special case for the path ".." as an argument. In a similar vein, the path ".." needs special-case handling when opening its parent and child file descriptots. With the special-case added, the test suite once again passes. --- src/libadacl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libadacl.c b/src/libadacl.c index a43afa5..911e69a 100644 --- a/src/libadacl.c +++ b/src/libadacl.c @@ -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); } -- 2.44.2