martine/ninja — pull request #578 by pinotree (2013-05-21 10:28:46+00:00)
Title: do not unconditionally use PATH_MAX with getcwd

Instead, grow a buffer until getcwd either succeeds or fails with an errno different than ERANGE
(meaning the passed buffer was too short to represent the actual path).
Reset errno before calling getcwd to check it eventually did not fail.

This fixes a build failure on GNU/Hurd, which does not provide PATH_MAX (which is optional in POSIX).