I just noticed a warning in pg_upgrade:
option.c: In function *parseCommandLine*:
option.c:96:8: warning: ignoring return value of *getcwd*,
declared
with attribute warn_unused_result
It looks like it might be worth testing the return value here for
NULL, which would indicate an error accessing the current working
directory. Untested patch attached for purposes of discussion.
http://www.kernel.org/doc/man-pages/online/pages/man3/getcwd.3.html
-Kevin