view doc/posix-functions/getcwd.texi @ 39913:73d60b1f9c96

doc: Update for Solaris 11.4. * doc/**/*.texi: For bugs that exist in both Solaris 11.3 and 11.4, mention Solaris 11.4. * m4/printf.m4: Update comments about Solaris. * m4/log.m4: Likewise. * m4/log10.m4: Likewise. * m4/logb.m4: Likewise. * m4/logbf.m4: Likewise. * m4/logbl.m4: Likewise. * m4/rename.m4: Likewise. * m4/wcrtomb.m4: Likewise. * m4/hostent.m4: Likewise. * m4/servent.m4: Likewise.
author Bruno Haible <bruno@clisp.org>
date Sun, 14 Oct 2018 09:33:46 +0200
parents 11af6bbd6df5
children
line wrap: on
line source

@node getcwd
@section @code{getcwd}
@findex getcwd

POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/getcwd.html}

Gnulib module: getcwd or getcwd-lgpl

Portability problems fixed by either Gnulib module @code{getcwd} or
@code{getcwd-lgpl}:
@itemize
@item
This function is declared in different header files (namely, @code{<io.h>} or
@code{<direct.h>}) on some platforms:
mingw, MSVC 14.
@item
On glibc and Solaris 11.4 platforms,
@code{getcwd (NULL, n)} allocates memory for the result.
On some other platforms, this call is not allowed.
@item
On some platforms, the prototype for @code{getcwd} uses @code{int}
instead of @code{size_t} for the size argument when using non-standard
headers, and the declaration is missing from @code{<unistd.h>}:
mingw, MSVC 14.
@item
On some platforms, @code{getcwd (buf, 0)} fails with @code{ERANGE}
instead of the required @code{EINVAL}:
mingw, MSVC 14.
@end itemize

Portability problems fixed by Gnulib module @code{getcwd}:
@itemize
@item
This function is missing on some older platforms.
@item
This function does not handle long file names (greater than @code{PATH_MAX})
correctly on some platforms:
glibc on Linux 2.4.20, Mac OS X 10.5, FreeBSD 6.4, NetBSD 5.1, OpenBSD 4.9, AIX 7.1.
@end itemize

Portability problems not fixed by Gnulib:
@itemize
@item
When using @code{getcwd(NULL, nonzero)}, some platforms, such as glibc
or cygwin, allocate exactly @code{nonzero} bytes and fail with
@code{ERANGE} if it was not big enough, while other platforms, such as
FreeBSD, mingw, or MSVC 14, ignore the size argument and allocate whatever size
is necessary.  If this call succeeds, an application cannot portably
access beyond the string length of the result.
@end itemize