Hash :
8585ce2f
Author :
Date :
2011-04-27T20:40:21
getcwd: fix mingw bugs On mingw, getcwd(NULL,1) succeeds, even though glibc documents that with a non-zero size, the allocation will not exceed that many bytes. On mingw, getcwd has the wrong signature. However, we don't have to check for this if anything else triggers the replacement. Also, fix a type bug that crept into the original getcwd-lgpl commit. * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): Detect one mingw bug. * doc/posix-functions/getcwd.texi (getcwd): Document the problems. * lib/getcwd-lgpl.c (rpl_getcwd): Fix return type. Signed-off-by: Eric Blake <eblake@redhat.com>
@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
On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
On some other platforms, this call is not allowed. Conversely, mingw fails
to honor non-zero @code{n}.
@item
On some platforms, the prototype for @code{getcwd} uses @code{int}
instead of @code{size_t} for the size argument:
mingw.
@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.
@end itemize
Portability problems not fixed by Gnulib:
@itemize
@end itemize