Fix _POSIX_C_SOURCE definition

Current code makes use of `snprintf` function defined in C99 standard
but _POSIX_C_SOURCE is set to "1" which is not correct. To access C99
definitions, this macro should be set to at least "200112L".

Also, `strncasecmp` function is being used but corresponding <strings.h>
header is not being included in miniwget.c.

Changes have been tested on FreeBSD 10.1 amd64 with default compiler
(Clang).
This commit is contained in:
Mike Gelfand 2014-11-19 17:06:14 +03:00
parent d4bf4c7572
commit c490b42547
4 changed files with 4 additions and 3 deletions

View File

@ -10,7 +10,7 @@ CFLAGS += -fPIC
CFLAGS += -ansi
CFLAGS += -Wall -W
CFLAGS += -D_BSD_SOURCE
CFLAGS += -D_POSIX_C_SOURCE=1
CFLAGS += -D_POSIX_C_SOURCE=200112L
LDFLAGS = -levent

View File

@ -30,7 +30,7 @@ endif (NO_GETADDRINFO)
if (NOT WIN32)
add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT)
add_definitions (-D_BSD_SOURCE -D_POSIX_C_SOURCE=1)
add_definitions (-D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L)
else (NOT WIN32)
add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends
endif (NOT WIN32)

View File

@ -35,7 +35,7 @@ CFLAGS += -W -Wstrict-prototypes
CFLAGS += -fno-common
CFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT
CFLAGS += -DMINIUPNPC_GET_SRC_ADDR
CFLAGS += -D_BSD_SOURCE -D_POSIX_C_SOURCE=1
CFLAGS += -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112L
CFLAGS += -ansi
# -DNO_GETADDRINFO
INSTALL = install

View File

@ -38,6 +38,7 @@
#include <net/if.h>
#include <netdb.h>
#define closesocket close
#include <strings.h>
#endif /* #else _WIN32 */
#ifdef __GNU__
#define MAXHOSTNAMELEN 64