bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] getcwd: fix compilation on mingw64


From: Eric Blake
Subject: [PATCH] getcwd: fix compilation on mingw64
Date: Wed, 17 Aug 2011 15:05:05 -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 <address@hidden>
---

I was able to reproduce the failure, as well as verify that
this patch resolves it.  Oddly, mingw32 only uses <io.h>,
but mingw64 changed things to use both <io.h> and <direct.h>.

 ChangeLog       |    5 +++++
 lib/unistd.in.h |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 770bdf7..7c8781f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-08-17  Eric Blake  <address@hidden>

+       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.

diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index e612fb3..c1cfb54 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -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>.
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]