From 549a9a671ad3c5e36717275d6656a96ca82d934e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 13 Jun 2023 15:54:21 +0200 Subject: [PATCH] fd-util: Add extra shortcut to path_is_root_at() --- src/basic/fd-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index ecbe58a9f83..d9ef7ec9326 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -900,9 +900,9 @@ int path_is_root_at(int dir_fd, const char *path) { assert(dir_fd >= 0 || dir_fd == AT_FDCWD); if (!isempty(path)) { - fd = openat(dir_fd, path, O_PATH|O_CLOEXEC); + fd = openat(dir_fd, path, O_PATH|O_DIRECTORY|O_CLOEXEC); if (fd < 0) - return -errno; + return errno == ENOTDIR ? false : -errno; dir_fd = fd; } -- 2.47.3