Fix broken safe_open() when path contains double slashes.