Add a protection preventing a potential infinite loop

Prevent a potential infinite loop when looking for the etc subdirectory (i.e. when reaching C:\). This fixes the Jira issue #ROOT-6833