My program is recursively traversing a project directory, where circular symlinks may occur which raise an exception (too many levels of symbolic links) in another step of the algorithm. I'd like to find circular symlinks to avoid such exceptions. (Fixing the project by removing circular symlinks is not an option unfortunately.)
Is there a way to uncover circular symlinks using boost::filesystem? I have already thought of resolving symlinks with read_symlink() and continue it in a recursive way if a symlink resolves to another symlink but that's not exactly the optimal solution.