Skip to content

Commit

Permalink
msvc: Fix compilation errors in compat/win32/sys/poll.c
Browse files Browse the repository at this point in the history
The msvc winsock2.h header file conditionally defines or declares
poll() related symbols which cause many macro redefinition errors,
a struct type redefinition error and syntax errors. These symbols
are defined in support of the WSAPoll() API, new in Windows Vista,
when the symbol _WIN32_WINNT is defined and _WIN32_WINNT >= 0x0600.

In order to avoid the compilation errors, we set _WIN32_WINNT to
0x0502 (which would target Windows Server 2003) prior to including
the winsock2.h header file.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Ramsay Jones authored and Junio C Hamano committed Dec 9, 2010
1 parent 89ba4e7 commit 56fb3dd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compat/win32/sys/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@

#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
# define WIN32_NATIVE
# if defined (_MSC_VER)
# define _WIN32_WINNT 0x0502
# endif
# include <winsock2.h>
# include <windows.h>
# include <io.h>
Expand Down

0 comments on commit 56fb3dd

Please sign in to comment.