opendir: Avoid compilation error on mingw.
authorBruno Haible <bruno@clisp.org>
Wed, 21 Sep 2011 21:19:44 +0000 (23:19 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 21 Sep 2011 21:19:44 +0000 (23:19 +0200)
* lib/opendir.c: Include <stddef.h> always. Include <unistd.h> as well.
* modules/opendir (Depends-on): Add unistd.

ChangeLog
lib/opendir.c
modules/opendir

index f215c17..db0bd7a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-09-21  Bruno Haible  <bruno@clisp.org>
 
+       opendir: Avoid compilation error on mingw.
+       * lib/opendir.c: Include <stddef.h> always. Include <unistd.h> as well.
+       * modules/opendir (Depends-on): Add unistd.
+
+2011-09-21  Bruno Haible  <bruno@clisp.org>
+
        ftruncate tests: Avoid a test failure on mingw.
        * tests/test-ftruncate.c (main): Allow a failure with EACCES.
 
index 06c611f..20ae75e 100644 (file)
@@ -20,6 +20,7 @@
 #include <dirent.h>
 
 #include <errno.h>
+#include <stddef.h>
 
 #if HAVE_OPENDIR
 
@@ -28,7 +29,6 @@
 
 #else
 
-# include <stddef.h>
 # include <stdlib.h>
 
 # include "dirent-private.h"
 
 #endif
 
+#if REPLACE_FCHDIR
+# include <unistd.h>
+#endif
+
 DIR *
 opendir (const char *dir_name)
 {
index ede6d48..adb2242 100644 (file)
@@ -10,6 +10,7 @@ Depends-on:
 dirent
 largefile
 filename        [test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1]
+unistd          [test $HAVE_OPENDIR = 0 || test $REPLACE_OPENDIR = 1]
 
 configure.ac:
 gl_FUNC_OPENDIR