Fix the build issue on GNU/Hurd

PATH_MAX isn't defined on GNU/Hurd. according to the porting guidelines
(https://www.gnu.org/software/hurd/hurd/porting/guidelines.html)
allocate a memory dynamically instead of relying on the length of
a string with PATH_MAX.

https://bugs.freedesktop.org/show_bug.cgi?id=97512
3 files changed