stat-util: teach statx_mount_same() STATX_MNT_ID_UNIQUE
So far statx_mount_same() assumed STATX_MNT_ID_UNIQUE didn't exist. However it does exist, hence do something useful if we see it set. Note that this creates a certain ambiguity: if we compare one statx struct with STATX_MNT_ID_UNIQUE and one without it (but with the regular mnt id), then we cnanot really come to a clear conclusion, hence need to introduce a third, unknown state. Note that we don't request STATX_MNT_ID_UNIQUE yet wherever we call statx_mount_same(). THis will be added in a later commit.
This commit is contained in:
+14
-5
@@ -379,11 +379,20 @@ int chaseat(int dir_fd, const char *path, ChaseFlags flags, char **ret_path, int
|
||||
* root tree we operate in is allowed, where an inode is moved up the tree while we
|
||||
* look at it, and thus get the current path wrong and think we are deeper down than
|
||||
* we actually are. */
|
||||
if (FLAGS_SET(flags, CHASE_AT_RESOLVE_IN_ROOT) &&
|
||||
(empty_or_root(done) || (statx_inode_same(&stx, &root_stx) && statx_mount_same(&stx, &root_stx)))) {
|
||||
if (FLAGS_SET(flags, CHASE_STEP))
|
||||
goto chased_one;
|
||||
continue;
|
||||
if (FLAGS_SET(flags, CHASE_AT_RESOLVE_IN_ROOT)) {
|
||||
bool is_root = empty_or_root(done);
|
||||
if (!is_root && statx_inode_same(&stx, &root_stx)) {
|
||||
r = statx_mount_same(&stx, &root_stx);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
is_root = r > 0;
|
||||
}
|
||||
if (is_root) {
|
||||
if (FLAGS_SET(flags, CHASE_STEP))
|
||||
goto chased_one;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
fd_parent = openat(fd, "..", O_CLOEXEC|O_NOFOLLOW|O_PATH|O_DIRECTORY);
|
||||
|
||||
Reference in New Issue
Block a user