Regression: Parent directory in recursion does not get processed properly.
The commit
8df0301badf6f38fcb4ddf73318e02708ad344f7 fixed a problem with the parent directory not being processed at all.
It failed to handle the situation where the child directory alters the path to append itself.
Save the parent directory path and then restore it after processing the child directory.
Many POSIX libc functions work on NULL termination where possible.
Make sure a NULL termination exists after restoring the path.