summaryrefslogtreecommitdiff
path: root/src/tmpfiles
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-03-21 21:17:22 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-03-24 13:43:51 +0100
commitf461a28da70320473c7466bcdc34fa601da0877b (patch)
tree8cb409e11d95129f208468588d2fc670e9d81bd4 /src/tmpfiles
parent0da2780c8a001e82695b261007966308be331bf3 (diff)
downloadsystemd-f461a28da70320473c7466bcdc34fa601da0877b.tar.gz
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.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r--src/tmpfiles/offline-passwd.c4
-rw-r--r--src/tmpfiles/tmpfiles.c10
2 files changed, 7 insertions, 7 deletions
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;