fd-util: do not call statx() twice when it does not provide mount ID
Previously, in path_is_root_at(), if statx() does not provide mount ID, path_get_mnt_id_at() was called, but it also calls statx(). Let's avoid the second trial.
This commit is contained in:
+2
-2
@@ -935,7 +935,7 @@ int path_is_root_at(int dir_fd, const char *path) {
|
||||
if (!FLAGS_SET(st.nsx.stx_mask, STATX_MNT_ID)) {
|
||||
int mntid;
|
||||
|
||||
r = path_get_mnt_id_at(dir_fd, "", &mntid);
|
||||
r = path_get_mnt_id_at_fallback(dir_fd, "", &mntid);
|
||||
if (r < 0) {
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return true; /* skip the mount ID check */
|
||||
@@ -950,7 +950,7 @@ int path_is_root_at(int dir_fd, const char *path) {
|
||||
if (!FLAGS_SET(pst.nsx.stx_mask, STATX_MNT_ID)) {
|
||||
int mntid;
|
||||
|
||||
r = path_get_mnt_id_at(dir_fd, "..", &mntid);
|
||||
r = path_get_mnt_id_at_fallback(dir_fd, "..", &mntid);
|
||||
if (r < 0) {
|
||||
if (ERRNO_IS_NOT_SUPPORTED(r))
|
||||
return true; /* skip the mount ID check */
|
||||
|
||||
Reference in New Issue
Block a user