5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getcwd.html}
7 Gnulib module: getcwd or getcwd-lgpl
9 Portability problems fixed by either Gnulib module @code{getcwd} or
13 This function is declared in different header files (namely, @code{<io.h>} or
14 @code{<direct.h>}) on some platforms:
17 On glibc and Solaris 11.4 platforms,
18 @code{getcwd (NULL, n)} allocates memory for the result.
19 On some other platforms, this call is not allowed.
21 On some platforms, the prototype for @code{getcwd} uses @code{int}
22 instead of @code{size_t} for the size argument when using non-standard
23 headers, and the declaration is missing from @code{<unistd.h>}:
26 On some platforms, @code{getcwd (buf, 0)} fails with @code{ERANGE}
27 instead of the required @code{EINVAL}:
31 Portability problems fixed by Gnulib module @code{getcwd}:
34 This function is missing on some older platforms.
36 This function does not handle long file names (greater than @code{PATH_MAX})
37 correctly on some platforms:
38 glibc on Linux 2.4.20, Mac OS X 10.5, FreeBSD 6.4, NetBSD 5.1, OpenBSD 4.9, AIX 7.1.
41 Portability problems not fixed by Gnulib:
44 When using @code{getcwd(NULL, nonzero)}, some platforms, such as glibc
45 or cygwin, allocate exactly @code{nonzero} bytes and fail with
46 @code{ERANGE} if it was not big enough, while other platforms, such as
47 FreeBSD, mingw, or MSVC 14, ignore the size argument and allocate whatever size
48 is necessary. If this call succeeds, an application cannot portably
49 access beyond the string length of the result.