Don't redefine fileno() if it exists.

Seems to be that way on MinGW.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7fe8961..aec107b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@
 CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
 CHECK_FUNCTION_EXISTS(_strdup HAVE__STRDUP)
 CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
+CHECK_FUNCTION_EXISTS(fileno HAVE_FILENO)
 CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO)
 CHECK_FUNCTION_EXISTS(ftello HAVE_FTELLO)
 CHECK_FUNCTION_EXISTS(open HAVE_OPEN)
diff --git a/configure.ac b/configure.ac
index 4b3f592..da4c58d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,7 +52,7 @@
 
 LT_INIT
 
-AC_CHECK_FUNCS([_close _dup _fdopen _fileno _open _snprintf _strdup _stricmp fseeko ftello getopt open snprintf strcasecmp strdup])
+AC_CHECK_FUNCS([_close _dup _fdopen _fileno _open _snprintf _strdup _stricmp fileno fseeko ftello getopt open snprintf strcasecmp strdup])
 AC_CHECK_FUNCS([mkstemp], [], [AC_LIBOBJ(mkstemp)])
 
 AC_CHECK_HEADERS([fts.h stdbool.h strings.h unistd.h])
diff --git a/lib/zipint.h b/lib/zipint.h
index 9954056..c7c2e3a 100644
--- a/lib/zipint.h
+++ b/lib/zipint.h
@@ -74,7 +74,7 @@
 #if defined(HAVE__FDOPEN)
 #define fdopen		_fdopen
 #endif
-#if defined(HAVE__FILENO)
+#if !defined(HAVE_FILENO) && defined(HAVE__FILENO)
 #define fileno		_fileno
 #endif
 /* Windows' open() doesn't understand Unix permissions */