I wonder, why getcwd() shouldn't use fork() or vfork(), but for this test to work correctly, you have to insert #include <stdlib> in the test program not to fail because fork() is not defined.