Bug#1898: getwd(3) contains falsehood
getwd, which is only prototyped if __USE_BSD is defined,
will malloc(3) an array big enough to hold the absolute
pathname of the current working directory.
However, the libc Info page says:
- Function: char * getwd (char *BUFFER)
This is similar to `getcwd', but has no way to specify the size of
the buffer. The GNU library provides `getwd' only for backwards
compatibility with BSD.
The BUFFER argument should be a pointer to an array at least
`PATH_MAX' bytes long (*note Limits for Files::.). In the GNU
system there is no limit to the size of a file name, so this is not
necessarily enough space to contain the directory name. That is
why this function is deprecated.
Experience seems to suggest that the libc Info page is right and the
manpage is wrong, at least if you pass a non-null argument to getwd.
The manpage should be changed to say that getwd is deprecated.