changeset 15737:802b8002c3f2

opendir: Avoid compilation error on mingw. * lib/opendir.c: Include <stddef.h> always. Include <unistd.h> as well. * modules/opendir (Depends-on): Add unistd.
author Bruno Haible <bruno@clisp.org>
date Wed, 21 Sep 2011 23:19:44 +0200
parents 06f18298ffd8
children 8c84ffc4d210
files ChangeLog lib/opendir.c modules/opendir
diffstat 3 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
--- a/lib/opendir.c
+++ b/lib/opendir.c
@@ -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"
@@ -36,6 +36,10 @@
 
 #endif
 
+#if REPLACE_FCHDIR
+# include <unistd.h>
+#endif
+
 DIR *
 opendir (const char *dir_name)
 {
--- a/modules/opendir
+++ b/modules/opendir
@@ -10,6 +10,7 @@
 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