https://bugs.winehq.org/show_bug.cgi?id=53683
--- Comment #13 from Erich E. Hoover erich.e.hoover@gmail.com --- (In reply to Tuupertunut from comment #12)
... You should not use chdir() when traversing path elements but for example use file descriptors instead.
I've been looking at simplifying this and this routine actually works with absolute paths the whole time, so you should be able to remove all the chdir nonsense. If you are willing to test that for me then I would appreciate it.