chiark / gitweb /
fs-util: export how many iterations chase_symlinks() executes at max
authorLennart Poettering <lennart@poettering.net>
Wed, 4 Apr 2018 15:06:12 +0000 (17:06 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
src/basic/fs-util.c
src/basic/fs-util.h

index 890a20a3ee7df3d11a8126d2ad06ad52019c5158..7ccd6da212019ffc6422a079a535dc90cd47345e 100644 (file)
@@ -597,7 +597,7 @@ static bool safe_transition(const struct stat *a, const struct stat *b) {
 int chase_symlinks(const char *path, const char *original_root, unsigned flags, char **ret) {
         _cleanup_free_ char *buffer = NULL, *done = NULL, *root = NULL;
         _cleanup_close_ int fd = -1;
-        unsigned max_follow = 32; /* how many symlinks to follow before giving up and returning ELOOP */
+        unsigned max_follow = CHASE_SYMLINKS_MAX; /* how many symlinks to follow before giving up and returning ELOOP */
         struct stat previous_stat;
         bool exists = true;
         char *todo;
index 4abbd0ea6760b69b24b3d4f602a52fc08490fede..654922fd1fddbc150bfeab1705d3e0f6d99f80ce 100644 (file)
@@ -94,6 +94,9 @@ enum {
         CHASE_STEP        = 1U << 6,   /* If set, just execute a single step of the normalization */
 };
 
+/* How many iterations to execute before returning -ELOOP */
+#define CHASE_SYMLINKS_MAX 32
+
 int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret);
 
 int chase_symlinks_and_open(const char *path, const char *root, unsigned chase_flags, int open_flags, char **ret_path);