If we get AT_FDCWD or root dir fd, we always resolve symlinks relative to the host's root.
Hence, the flag is meaningless.
* the mount point is emitted. CHASE_WARN cannot be used in PID 1.
*/
+ if (FLAGS_SET(flags, CHASE_AT_RESOLVE_IN_ROOT)) {
+ /* If we get AT_FDCWD or dir_fd points to "/", then we always resolve symlinks relative to
+ * the host's root. Hence, CHASE_AT_RESOLVE_IN_ROOT is meaningless. */
+
+ if (dir_fd >= 0)
+ r = dir_fd_is_root(dir_fd);
+ else
+ r = true;
+ if (r < 0)
+ return r;
+ if (r > 0)
+ flags &= ~CHASE_AT_RESOLVE_IN_ROOT;
+ }
+
if (!(flags &
(CHASE_AT_RESOLVE_IN_ROOT|CHASE_NONEXISTENT|CHASE_NO_AUTOFS|CHASE_SAFE|CHASE_STEP|
CHASE_PROHIBIT_SYMLINKS|CHASE_MKDIR_0755)) &&