Cycle Checking in Depth-First Search

Infinite paths make depth-first search incomplete. How can we fix this? Cycle-checking.