Fix infinite loop upon encountering a recursive symbolic link.