Opened 16 years ago
Closed 16 years ago
#4100 closed Bug report (fixed)
ntohs() defintion issues with HP-UX 11.X
Reported by: | Richard Lloyd | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | FileZilla Client |
Keywords: | Cc: | ||
Component version: | Operating system type: | Other | |
Operating system version: | HP-UX 11.X |
Description
HP-UX 11.X has an annoying habit of putting function or macro declarations of the same functions in more than one system header file and then documenting which header file to include in the man page, dependent on the compiler flags you use. Yes, it is barmy and, unfortunately, ntohs() is one of those functions.
"man ntohs" says that #include <netinet/in.h> should be used to declare the ntohs() function *unless* _XOPEN_SOURCE_EXTENDED is defined, in which case #include <arpa/inet.h> is included instead. I've been compiling the FileZilla Client 3.1.6 with -D_XOPEN_SOURCE_EXTENDED in HP-UX 11.X, so the #include <netinet/in.h> in src/engine/socket.cpp isn't good enough to declare ntohs(). Here's a fix I inserted just above the include in src/engine/socket.cpp (line 24 or so):
#if defined(hpux) && defined(_XOPEN_SOURCE_EXTENDED)
#include <arpa/inet.h>
#endif
#include <netinet/in.h>
You may find a more elegant way to do this (e.g. if all systems have <arpa/inet.h>, you might not need the defined(hpux) bit).
Thanks. Now arpa/inet.h gets unconditionally included, like it's done in the contained PuTTY sources.