]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
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)
committerLennart Poettering <lennart@poettering.net>
Wed, 18 Apr 2018 12:15:48 +0000 (14:15 +0200)
src/basic/fs-util.c
src/basic/fs-util.h

index c0ba1f18d134445bf46e076370018f37a50318fd..3dc194ca6e7c6b7b98702bf86c66ebaf1f8fb0e6 100644 (file)
@@ -582,7 +582,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 16f20cecdfbb1c14d52434cdbba3846c6989eae1..e8362b92a5b8fb205c7de268fd60f0482007d5ea 100644 (file)
@@ -78,6 +78,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);