diff options
author | Krzesimir Nowak <knowak@microsoft.com> | 2024-04-11 14:40:35 +0200 |
---|---|---|
committer | Krzesimir Nowak <knowak@microsoft.com> | 2024-04-19 08:33:04 +0200 |
commit | 90ace863593bfdaff96a5f82fec4c0baaf4cbbd3 (patch) | |
tree | cf6e2a443b4af5658f4cdd817ff93b03dc5f6766 /src/sysext | |
parent | path-util: Add a helper for checking paths (diff) | |
download | systemd-90ace863593bfdaff96a5f82fec4c0baaf4cbbd3.tar.xz systemd-90ace863593bfdaff96a5f82fec4c0baaf4cbbd3.zip |
sysext: Use the new path-util helper
Diffstat (limited to 'src/sysext')
-rw-r--r-- | src/sysext/sysext.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/sysext/sysext.c b/src/sysext/sysext.c index ad7521425e..ad8785cd46 100644 --- a/src/sysext/sysext.c +++ b/src/sysext/sysext.c @@ -897,18 +897,6 @@ static int overlayfs_paths_new(const char *hierarchy, const char *workspace_path return 0; } -static int resolved_paths_equal(const char *resolved_a, const char *resolved_b) { - /* Returns true if paths are of the same entry, false if not, <0 on error. */ - - if (path_equal(resolved_a, resolved_b)) - return 1; - - if (!resolved_a || !resolved_b) - return 0; - - return inode_same(resolved_a, resolved_b, 0); -} - static int maybe_import_mutable_directory(OverlayFSPaths *op) { int r; @@ -920,7 +908,7 @@ static int maybe_import_mutable_directory(OverlayFSPaths *op) { if (arg_mutable != MUTABLE_IMPORT || !op->resolved_mutable_directory) return 0; - r = resolved_paths_equal(op->resolved_hierarchy, op->resolved_mutable_directory); + r = path_equal_or_inode_same_full(op->resolved_hierarchy, op->resolved_mutable_directory, 0); if (r < 0) return log_error_errno(r, "Failed to check equality of hierarchy %s and its mutable directory %s: %m", op->resolved_hierarchy, op->resolved_mutable_directory); if (r > 0) @@ -960,7 +948,7 @@ static int maybe_import_ignored_mutable_directory(OverlayFSPaths *op) { if (r < 0) return log_error_errno(r, "Failed to resolve mutable directory '%s': %m", path); - r = resolved_paths_equal(op->resolved_hierarchy, resolved_path); + r = path_equal_or_inode_same_full(op->resolved_hierarchy, resolved_path, 0); if (r < 0) return log_error_errno(r, "Failed to check equality of hierarchy %s and its mutable directory %s: %m", op->resolved_hierarchy, op->resolved_mutable_directory); @@ -1069,7 +1057,7 @@ static int hierarchy_as_lower_dir(OverlayFSPaths *op) { return 0; } - r = resolved_paths_equal(op->resolved_hierarchy, op->resolved_mutable_directory); + r = path_equal_or_inode_same_full(op->resolved_hierarchy, op->resolved_mutable_directory, 0); if (r < 0) return log_error_errno(r, "Failed to check equality of hierarchy %s and its mutable directory %s: %m", op->resolved_hierarchy, op->resolved_mutable_directory); if (r > 0) { |