unistd: Ensure getcwd gets declared before being overridden.
authorBruno Haible <bruno@clisp.org>
Wed, 23 Dec 2009 09:59:14 +0000 (10:59 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 23 Dec 2009 09:59:14 +0000 (10:59 +0100)
ChangeLog
lib/unistd.in.h

index dc63d28..8ec7958 100644 (file)
--- 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.
index f37c7ba..a3a49ed 100644 (file)
 
 /* 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@))