{"thread":{"id":"33011","subject":"[PATCH] git-compat-util.h: Provide missing netdb.h definitions","startedAt":"2013-02-25T19:30:19Z","lastAt":"2013-02-25T20:16:21Z","messageCount":2,"participants":["David Michael","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"210280","messageId":"CAEvUa7n_EsKnKQNuyvSiZW8s_rZv4oQrFNDX9wa_JSr_REj89w@mail.gmail.com","threadId":"33011","inReplyTo":null,"subject":"[PATCH] git-compat-util.h: Provide missing netdb.h definitions","fromName":"David Michael","fromEmail":"fedora.dm0@gmail.com","sentAt":"2013-02-25T19:30:19Z","receivedAt":"2013-02-25T19:30:19Z","isPatch":true,"sender":{"key":"fedora.dm0@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1379865?v=4"},"body":"Some platforms may lack the NI_MAXHOST and NI_MAXSERV values in their\nsystem headers, so ensure they are available.\n\nSigned-off-by: David Michael <fedora.dm0@gmail.com>\n---\n\nNI_MAXHOST is missing from my platform, and it has no compatibility\ndefinition anywhere.\n\n    $ grep -FIR NI_MAXHOST\n    imap-send.c:            char addr[NI_MAXHOST];\n    connect.c:    static char addr[NI_MAXHOST];\n\nI've been defining it in CFLAGS, but I noticed there is precedence for\nthis type of definition in git-compat-util.h.  This patch adds a\ndefinition for compatibility.\n\nIn addition, all the documentation I've seen mentions NI_MAXHOST and\nNI_MAXSERV together, so this also moves the NI_MAXSERV definition to\ngit-compat-util.h for consistency.\n\n daemon.c          |  4 ----\n git-compat-util.h | 11 +++++++++++\n 2 files changed, 11 insertions(+), 4 deletions(-)\n\ndiff --git a/daemon.c b/daemon.c\nindex 4602b46..df8c0ab 100644\n--- a/daemon.c\n+++ b/daemon.c\n@@ -9,10 +9,6 @@\n #define HOST_NAME_MAX 256\n #endif\n\n-#ifndef NI_MAXSERV\n-#define NI_MAXSERV 32\n-#endif\n-\n #ifdef NO_INITGROUPS\n #define initgroups(x, y) (0) /* nothing */\n #endif\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex b7eaaa9..2580c6b 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -213,6 +213,17 @@ extern char *gitbasename(char *);\n #include <openssl/err.h>\n #endif\n\n+/* On most systems <netdb.h> would have given us this, but\n+ * not on some systems (e.g. z/OS).\n+ */\n+#ifndef NI_MAXHOST\n+#define NI_MAXHOST 1025\n+#endif\n+\n+#ifndef NI_MAXSERV\n+#define NI_MAXSERV 32\n+#endif\n+\n /* On most systems <limits.h> would have given us this, but\n  * not on some systems (e.g. GNU/Hurd).\n  */\n--\n1.8.1.2\n"},{"id":"210289","messageId":"7vwqtww3my.fsf@alter.siamese.dyndns.org","threadId":"33011","inReplyTo":"CAEvUa7n_EsKnKQNuyvSiZW8s_rZv4oQrFNDX9wa_JSr_REj89w@mail.gmail.com","subject":"Re: [PATCH] git-compat-util.h: Provide missing netdb.h definitions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-25T20:16:21Z","receivedAt":"2013-02-25T20:16:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}