chiark / gitweb /
fs-util: add calls that combine chase_symlinks() and open()/opendir() in one
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Mar 2018 12:15:43 +0000 (14:15 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
This is useful when opening files within disk images, as we'll then take
the relative root directory properly into account.

src/basic/fs-util.c

index fe8554842f9976653fe6b6a2d0c4c501d99027ac..d43aca249776c87d105d4679c9ab247f9a4d9291 100644 (file)
@@ -649,16 +649,6 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
         if (noop_root(original_root))
                 original_root = NULL;
 
-        if (!original_root && !ret && (flags & (CHASE_NONEXISTENT|CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_OPEN)) == CHASE_OPEN) {
-                /* Shortcut the CHASE_OPEN case if the caller isn't interested in the actual path and has no root set
-                 * and doesn't care about any of the other special features we provide either. */
-                r = open(path, O_PATH|O_CLOEXEC);
-                if (r < 0)
-                        return -errno;
-
-                return r;
-        }
-
         if (original_root) {
                 r = path_make_absolute_cwd(original_root, &root);
                 if (r < 0)