5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html}
7 LSB specification:@* @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-getcwd.html}
9 Gnulib module: getcwd or getcwd-lgpl
11 Portability problems fixed by either Gnulib module @code{getcwd} or
15 This function is declared in different header files (namely, @code{<io.h>} or
16 @code{<direct.h>}) on some platforms:
19 On glibc and Solaris 11.4 platforms,
20 @code{getcwd (NULL, n)} allocates memory for the result.
21 On some other platforms, this call is not allowed.
23 On some platforms, the prototype for @code{getcwd} uses @code{int}
24 instead of @code{size_t} for the size argument when using non-standard
25 headers, and the declaration is missing from @code{<unistd.h>}:
28 On some platforms, @code{getcwd (buf, 0)} crashes:
31 On some platforms, @code{getcwd (buf, 0)} fails with @code{ERANGE}
32 instead of the required @code{EINVAL}:
36 Portability problems fixed by Gnulib module @code{getcwd}:
39 This function does not handle long file names (greater than @code{PATH_MAX})
40 correctly on some platforms:
41 glibc on Linux 2.4.20, Mac OS X 10.13, FreeBSD 6.4, NetBSD 9.0, OpenBSD 4.9, AIX 7.1.
44 Portability problems not fixed by Gnulib:
47 When using @code{getcwd(NULL, nonzero)}, some platforms, such as glibc
48 or cygwin, allocate exactly @code{nonzero} bytes and fail with
49 @code{ERANGE} if it was not big enough, while other platforms, such as
50 FreeBSD, mingw, or MSVC 14, ignore the size argument and allocate whatever size
51 is necessary. If this call succeeds, an application cannot portably
52 access beyond the string length of the result.