changeset 12479:3607500d4523

unistd: Ensure getcwd gets declared before being overridden.
author Bruno Haible <bruno@clisp.org>
date Wed, 23 Dec 2009 10:59:14 +0100
parents 0c2e471e00e6
children 4756a0883f46
files ChangeLog lib/unistd.in.h
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-23  Bruno Haible  <bruno@clisp.org>
+
+	unistd: Ensure getcwd gets declared before being overridden.
+	* lib/unistd.in.h: Conditionally include <io.h>.
+
 2009-12-22  Bruno Haible  <bruno@clisp.org>
 
 	wchar: Diagnose broken combination of glibc and gcc versions and flags.
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -39,8 +39,14 @@
 
 /* mingw fails to declare _exit in <unistd.h>.  */
 /* mingw, BeOS, Haiku declare environ in <stdlib.h>, not in <unistd.h>.  */
+/* Solaris declares getcwd not only in <unistd.h> but also in <stdlib.h>.  */
 #include <stdlib.h>
 
+/* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
+#if @GNULIB_GETCWD@ && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #if ((@GNULIB_WRITE@ && @REPLACE_WRITE@ && @GNULIB_UNISTD_H_SIGPIPE@)   \
      || (@GNULIB_READLINK@ && (!@HAVE_READLINK@ || @REPLACE_READLINK@)) \
      || (@GNULIB_READLINKAT@ && !@HAVE_READLINKAT@))