From f461a28da70320473c7466bcdc34fa601da0877b Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Tue, 21 Mar 2023 21:17:22 +0100 Subject: chase-symlinks: Rename chase_symlinks() to chase() Chasing symlinks is a core function that's used in a lot of places so it deservers a less verbose names so let's rename it to chase() and chaseat(). We also slightly change the pattern used for the chaseat() helpers so we get chase_and_openat() and similar. --- src/tmpfiles/offline-passwd.c | 4 ++-- src/tmpfiles/tmpfiles.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/tmpfiles') diff --git a/src/tmpfiles/offline-passwd.c b/src/tmpfiles/offline-passwd.c index fe866f8ca1..edf0dfb73d 100644 --- a/src/tmpfiles/offline-passwd.c +++ b/src/tmpfiles/offline-passwd.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include "chase-symlinks.h" +#include "chase.h" #include "fd-util.h" #include "offline-passwd.h" #include "path-util.h" @@ -13,7 +13,7 @@ static int open_passwd_file(const char *root, const char *fname, FILE **ret_file _cleanup_close_ int fd = -EBADF; _cleanup_fclose_ FILE *f = NULL; - fd = chase_symlinks_and_open(fname, root, CHASE_PREFIX_ROOT, O_RDONLY|O_CLOEXEC, &p); + fd = chase_and_open(fname, root, CHASE_PREFIX_ROOT, O_RDONLY|O_CLOEXEC, &p); if (fd < 0) return fd; diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 73beff063b..c3741088c3 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -22,7 +22,7 @@ #include "btrfs-util.h" #include "build.h" #include "capability-util.h" -#include "chase-symlinks.h" +#include "chase.h" #include "chattr-util.h" #include "conf-files.h" #include "constants.h" @@ -982,7 +982,7 @@ static int path_open_parent_safe(const char *path, bool allow_failure) { path, allow_failure ? ", ignoring" : ""); - r = chase_symlinks(dn, arg_root, allow_failure ? CHASE_SAFE : CHASE_SAFE|CHASE_WARN, NULL, &fd); + r = chase(dn, arg_root, allow_failure ? CHASE_SAFE : CHASE_SAFE|CHASE_WARN, NULL, &fd); if (r == -ENOLINK) /* Unsafe symlink: already covered by CHASE_WARN */ return r; if (r < 0) @@ -1007,7 +1007,7 @@ static int path_open_safe(const char *path) { if (!path_is_normalized(path)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Failed to open invalid path '%s'.", path); - r = chase_symlinks(path, arg_root, CHASE_SAFE|CHASE_WARN|CHASE_NOFOLLOW, NULL, &fd); + r = chase(path, arg_root, CHASE_SAFE|CHASE_WARN|CHASE_NOFOLLOW, NULL, &fd); if (r == -ENOLINK) return r; /* Unsafe symlink: already covered by CHASE_WARN */ if (r < 0) @@ -1824,7 +1824,7 @@ static int empty_directory(Item *i, const char *path, CreationMode creation) { assert(i); assert(i->type == EMPTY_DIRECTORY); - r = chase_symlinks(path, arg_root, CHASE_SAFE|CHASE_WARN, NULL, &fd); + r = chase(path, arg_root, CHASE_SAFE|CHASE_WARN, NULL, &fd); if (r == -ENOLINK) /* Unsafe symlink: already covered by CHASE_WARN */ return r; if (r == -ENOENT) { @@ -2789,7 +2789,7 @@ static int process_item(Item *i, OperationMask operation) { path = _path; } - r = chase_symlinks(path, arg_root, CHASE_NO_AUTOFS|CHASE_NONEXISTENT|CHASE_WARN, NULL, NULL); + r = chase(path, arg_root, CHASE_NO_AUTOFS|CHASE_NONEXISTENT|CHASE_WARN, NULL, NULL); if (r == -EREMOTE) { log_notice_errno(r, "Skipping %s", i->path); /* We log the configured path, to not confuse the user. */ return 0; -- cgit v1.2.1