+2011-04-27 Eric Blake <eblake@redhat.com>
+
+ getcwd: fix mingw bugs
+ * 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.
+
2011-04-27 Bruno Haible <bruno@clisp.org>
mkstemps: Ensure declaration on MacOS X 10.5.
@itemize
@item
On glibc platforms, @code{getcwd (NULL, n)} allocates memory for the result.
-On other platforms, this call is not allowed.
+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}:
# with or without modifications, as long as this notice is preserved.
# Written by Paul Eggert.
-# serial 5
+# serial 6
AC_DEFUN([gl_FUNC_GETCWD_NULL],
[
# endif
]], [[
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* mingw cwd does not start with '/', but getcwd does allocate. */
+/* mingw cwd does not start with '/', but getcwd does allocate.
+ However, mingw fails to honor non-zero size. */
#else
if (chdir ("/") != 0)
return 1;
return 0;
}
#endif
+ /* If size is non-zero, allocation must fail if size is too small */
+ if (getcwd (NULL, 1))
+ return 5;
]])],
[gl_cv_func_getcwd_null=yes],
[gl_cv_func_getcwd_null=no],
*-gnu*) gl_cv_func_getcwd_null="guessing yes";;
# Guess yes on Cygwin.
cygwin*) gl_cv_func_getcwd_null="guessing yes";;
- # Guess yes on mingw.
- mingw*) gl_cv_func_getcwd_null="guessing yes";;
# If we don't know, assume the worst.
*) gl_cv_func_getcwd_null="guessing no";;
esac