Gisle Vanem
2014-04-04 13:55:43 UTC
I note that a local "Win32/include/errno.h" is shadowing for the
real <errno.h> which is not nice. And shouldn't sys-headers come first
in missing/inet_pton.c?
#include <tcpdump-stdinc.h>
#include <errno.h>
Since MSVC's <errno.h> has a 'EAFNOSUPPORT', but MingW+Watcom
does not, I think it's cleaner to remove the local Win32/include/errno.h and do
some checks in tcpdump-stdinc.h instead:
-#include <Ws2tcpip.h>
+#include <ws2tcpip.h> <<<!! use the real name incase someone cross-compiles
#include "bittypes.h"
#include <ctype.h>
#include <time.h>
#include <io.h>
+#include <errno.h>
...
+/* It is in MSVC's <errno.h>, but not defined in MingW+Watcom.
+ */
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT WSAEAFNOSUPPORT
+#endif
+
Other targets using missing/inet_pton.c should thus work as before.
BTW. there is a similar issue with EAFNOSUPPORT (and _errno()) in libpcap
that I can come back to.
--gv
real <errno.h> which is not nice. And shouldn't sys-headers come first
in missing/inet_pton.c?
#include <tcpdump-stdinc.h>
#include <errno.h>
Since MSVC's <errno.h> has a 'EAFNOSUPPORT', but MingW+Watcom
does not, I think it's cleaner to remove the local Win32/include/errno.h and do
some checks in tcpdump-stdinc.h instead:
-#include <Ws2tcpip.h>
+#include <ws2tcpip.h> <<<!! use the real name incase someone cross-compiles
#include "bittypes.h"
#include <ctype.h>
#include <time.h>
#include <io.h>
+#include <errno.h>
...
+/* It is in MSVC's <errno.h>, but not defined in MingW+Watcom.
+ */
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT WSAEAFNOSUPPORT
+#endif
+
Other targets using missing/inet_pton.c should thus work as before.
BTW. there is a similar issue with EAFNOSUPPORT (and _errno()) in libpcap
that I can come back to.
--gv