libutils/safe_open: fix case that a dir ends in slash/

The loop that splits a path into "component" dirs would try to process
the empty string after a final slash like in "some/dir/" .
You see, the (now removed) inner while-loop would skip successive
slashes, but only in the middle of the path string.
Now, empty components are skipped, which uses the outer loop to find
next component after an empty (double-slash) directory.