Skip to content

Commit aa44425

Browse files
committed
Avoid errors redefining getpid() for MingW
We use a macro for getpid but MingW define a getpid function which can clash with our definition. Include unistd.h header earlier to avoid the clash later. Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
1 parent 71d3793 commit aa44425

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/freetds/sysdep_private.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
#include <ioLib.h> /* for FIONBIO */
4040
#endif /* __INCvxWorksh */
4141

42+
#ifdef __MINGW32__
43+
/* getpid() is defined as a function in MingW but this conflict with our definition as
44+
* macro later in this file, so include unistd.h to get function definition earlier and
45+
* avoid errors including unistd.h header later in the code */
46+
#include <unistd.h>
47+
#endif
48+
4249
#if defined(DOS32X)
4350
#define READSOCKET(a,b,c) recv((a), (b), (c), TDS_NOSIGNAL)
4451
#define WRITESOCKET(a,b,c) send((a), (b), (c), TDS_NOSIGNAL)

0 commit comments

Comments
 (0)