Bug #62636 Redefine INVALID_SOCKET
Submitted: 5 Oct 2011 22:34 Modified: 6 Oct 2011 3:52
Reporter: Robert Gebis Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:5.5.16, 5.5.17 OS:Other (Mac and Linux)
Assigned to: CPU Architecture:Any
Tags: INVALID_SOCKET, my_global.h

[5 Oct 2011 22:34] Robert Gebis
Description:
Related to Bug #13754

I have few products/libs that are cross platform and I am using them in my project.
The problem is that both projects define INVALID_SOCKET (mysql is one of them)
where INVALID_SOCKET is defined same way by all but neither specify #ifndef around it.
On windows it is no problem but on Linux, Mac and Solaris I have this problem.
I try to put suffused fix in my_global.h and it works temporary.

How to repeat:
I am building my projects with other 3rd party libs on none windows platform

Suggested fix:
Replace my_global.h

#ifdef _WIN32
     typedef SOCKET my_socket;
#else
     typedef int	my_socket;	/* File descriptor for sockets */
     #define INVALID_SOCKET -1
#endif

With

#ifdef _WIN32
     typedef SOCKET my_socket;
#else
     typedef int	my_socket;	/* File descriptor for sockets */
     #ifndef INVALID_SOCKET
          #define INVALID_SOCKET -1
     #endif
#endif
[6 Oct 2011 3:52] Valeriy Kravchuk
Thank you for the problem report. Verified by code review.