getcwd: fix compilation on mingw64
authorEric Blake <eblake@redhat.com>
Wed, 17 Aug 2011 20:13:35 +0000 (14:13 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 17 Aug 2011 20:36:54 +0000 (14:36 -0600)
Mingw 64 added <direct.h> as a place that declared getcwd.  It is
a non-standard header, but since we already include it in the
replacement for <sys/stat.h>, we must also include it in the
replacement for <unistd.h> to avoid compilation problems.

* lib/unistd.in.h (includes) [mingw]: Include <direct.h> for
getcwd.
Reported by Marc-AndrĂ© Lureau.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
lib/unistd.in.h

index 770bdf7..7c8781f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-17  Eric Blake  <eblake@redhat.com>
 
+       getcwd: fix compilation on mingw64
+       * lib/unistd.in.h (includes) [mingw]: Include <direct.h> for
+       getcwd.
+       Reported by Marc-AndrĂ© Lureau.
+
        pipe2: silence compiler warning
        * lib/pipe2.c (pipe2): Hide label if it is not used.
 
index e612fb3..c1cfb54 100644 (file)
@@ -85,7 +85,8 @@
 /* mingw declares getcwd in <io.h>, not in <unistd.h>.  */
 #if ((@GNULIB_GETCWD@ || defined GNULIB_POSIXCHECK) \
      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
-# include <io.h>
+# include <io.h>     /* mingw32, mingw64 */
+# include <direct.h> /* mingw64 */
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.