stat-util: rename files_same() → inode_same()
Let's be more accurate about what this function does: it checks whether the underlying reported inode is the same. Internally, this already uses a better named stat_inode_same() call, hence let's similarly name the wrapping function following the same logic. Similar for files_same_at() and path_equal_or_same_files(). No code changes, just some renaming.
This commit is contained in:
@@ -493,7 +493,7 @@ static int chroot_unit_symlinks_equivalent(
|
||||
if (!a || !b)
|
||||
return log_oom();
|
||||
|
||||
r = path_equal_or_files_same(a, b, 0);
|
||||
r = path_equal_or_inode_same(a, b, 0);
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
|
||||
+1
-1
@@ -438,7 +438,7 @@ int rm_rf(const char *path, RemoveFlags flags) {
|
||||
|
||||
/* We refuse to clean the root file system with this call. This is extra paranoia to never cause a
|
||||
* really seriously broken system. */
|
||||
if (path_equal_or_files_same(path, "/", AT_SYMLINK_NOFOLLOW))
|
||||
if (path_equal_or_inode_same(path, "/", AT_SYMLINK_NOFOLLOW))
|
||||
return log_error_errno(SYNTHETIC_ERRNO(EPERM),
|
||||
"Attempted to remove entire root file system (\"%s\"), and we can't allow that.",
|
||||
path);
|
||||
|
||||
@@ -45,7 +45,7 @@ int switch_root(const char *new_root,
|
||||
if (new_root_fd < 0)
|
||||
return log_error_errno(errno, "Failed to open target directory '%s': %m", new_root);
|
||||
|
||||
r = files_same_at(old_root_fd, "", new_root_fd, "", AT_EMPTY_PATH);
|
||||
r = inode_same_at(old_root_fd, "", new_root_fd, "", AT_EMPTY_PATH);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine if old and new root directory are the same: %m");
|
||||
if (r > 0) {
|
||||
|
||||
Reference in New Issue
Block a user