Bläddra i källkod

o Include <sys/types.h> before any other <sys/foo> and network-related headers;

o on FreeBSD, it is necessary to include <netinet/in_systm.h> before
  <netinet/ip.h>, so that add it and make conditional on a new
  HAVE_NETINET_IN_SYSTM define. I suspect that other BSD-derifed platforms
  need it as well.
Maxim Sobolev 20 år sedan
förälder
incheckning
a73806997d
2 ändrade filer med 6 tillägg och 2 borttagningar
  1. 2 1
      Makefile.defs
  2. 4 1
      main.c

+ 2 - 1
Makefile.defs

@@ -1066,7 +1066,8 @@ endif
 ifeq ($(OS), freebsd)
 	DEFS+=-DHAVE_SOCKADDR_SA_LEN -DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN \
 		-DHAVE_SCHED_YIELD -DHAVE_MSGHDR_MSG_CONTROL \
-		-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM
+		-DHAVE_CONNECT_ECONNRESET_BUG -DHAVE_TIMEGM \
+		-DHAVE_NETINET_IN_SYSTM
 	ifneq ($(found_lock_method), yes)
 		DEFS+= -DUSE_PTHREAD_MUTEX  # try pthread sems
 		found_lock_method=yes

+ 4 - 1
main.c

@@ -71,12 +71,15 @@
 #include <string.h>
 #include <netdb.h>
 #include <unistd.h>
+#include <sys/types.h>
 #include <sys/socket.h>
+#if defined(HAVE_NETINET_IN_SYSTM)
+#include <netinet/in_systm.h>
+#endif
 #include <netinet/in.h>
 #include <netinet/ip.h>
 #include <arpa/inet.h>
 #include <sys/utsname.h>
-#include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
 #include <fcntl.h>