summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2016-02-22 16:20:00 +0000
committerAdam Jackson <ajax@redhat.com>2016-02-22 14:26:38 -0500
commit30b7d7995ef70b7473e0fb170eb8ae23b8d1f4a7 (patch)
treecd6adaf0ac7694b9868f7dbd37b37acba5b5f420 /os
parent544b4149268561d3d794aa540172831fa7550a20 (diff)
Fix build on Cygwin by ensuring WIN32 check triggers only on MinGW
The type of fd_mask was changed in Cygwin 2.4.0 headers from 'long' to 'unsigned long'. This exposes an existing problem with winauth.c, which includes Xwindows.h (which includes windows.h, which defines WIN32), before including osdep.h, which causes the now conflicting definition of fd_mask in osdep.h to be exposed: In file included from ../os/osdep.h:198:18: error: conflicting types for ‘fd_mask’ typedef long int fd_mask; /usr/include/sys/select.h:46:23: note: previous declaration of ‘fd_mask’ was here typedef unsigned long fd_mask; Adjust the include guards in osdep.h to make sure we only use WIN32 guarded code when not compiling for Cygwin (i.e. WIN32 && !__CYGWIN__) This isn't a very elegant, but unfortunately appears to be the best solution, since it doesn't seem to be possible to write the test in a positive form. Future work: Should also audit of all the other uses of WIN32 in xserver, and make sure they are correct. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Diffstat (limited to 'os')
-rw-r--r--os/osdep.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/os/osdep.h b/os/osdep.h
index 2fbfc48f6..3dc2daf55 100644
--- a/os/osdep.h
+++ b/os/osdep.h
@@ -72,7 +72,7 @@ SOFTWARE.
#if defined(NOFILE) && !defined(NOFILES_MAX)
#define OPEN_MAX NOFILE
#else
-#if !defined(WIN32)
+#if !defined(WIN32) || defined(__CYGWIN__)
#define OPEN_MAX NOFILES_MAX
#else
#define OPEN_MAX 512
@@ -178,7 +178,7 @@ extern fd_set ClientsWriteBlocked;
extern fd_set OutputPending;
extern fd_set IgnoredClientsWithInput;
-#ifndef WIN32
+#if !defined(WIN32) || defined(__CYGWIN__)
extern int *ConnectionTranslation;
#else
extern int GetConnectionTranslation(int conn);
@@ -193,7 +193,7 @@ extern Bool NumNotifyWriteFd;
extern WorkQueuePtr workQueue;
/* in WaitFor.c */
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__)
typedef long int fd_mask;
#endif
#define ffs mffs