git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Michael <fedora.dm0@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] git-compat-util.h: Provide missing netdb.h definitions
Date: Mon, 25 Feb 2013 14:30:19 -0500	[thread overview]
Message-ID: <CAEvUa7n_EsKnKQNuyvSiZW8s_rZv4oQrFNDX9wa_JSr_REj89w@mail.gmail.com> (raw)

Some platforms may lack the NI_MAXHOST and NI_MAXSERV values in their
system headers, so ensure they are available.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---

NI_MAXHOST is missing from my platform, and it has no compatibility
definition anywhere.

    $ grep -FIR NI_MAXHOST
    imap-send.c:            char addr[NI_MAXHOST];
    connect.c:    static char addr[NI_MAXHOST];

I've been defining it in CFLAGS, but I noticed there is precedence for
this type of definition in git-compat-util.h.  This patch adds a
definition for compatibility.

In addition, all the documentation I've seen mentions NI_MAXHOST and
NI_MAXSERV together, so this also moves the NI_MAXSERV definition to
git-compat-util.h for consistency.

 daemon.c          |  4 ----
 git-compat-util.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/daemon.c b/daemon.c
index 4602b46..df8c0ab 100644
--- a/daemon.c
+++ b/daemon.c
@@ -9,10 +9,6 @@
 #define HOST_NAME_MAX 256
 #endif

-#ifndef NI_MAXSERV
-#define NI_MAXSERV 32
-#endif
-
 #ifdef NO_INITGROUPS
 #define initgroups(x, y) (0) /* nothing */
 #endif
diff --git a/git-compat-util.h b/git-compat-util.h
index b7eaaa9..2580c6b 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -213,6 +213,17 @@ extern char *gitbasename(char *);
 #include <openssl/err.h>
 #endif

+/* On most systems <netdb.h> would have given us this, but
+ * not on some systems (e.g. z/OS).
+ */
+#ifndef NI_MAXHOST
+#define NI_MAXHOST 1025
+#endif
+
+#ifndef NI_MAXSERV
+#define NI_MAXSERV 32
+#endif
+
 /* On most systems <limits.h> would have given us this, but
  * not on some systems (e.g. GNU/Hurd).
  */
--
1.8.1.2

             reply	other threads:[~2013-02-25 19:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 19:30 David Michael [this message]
2013-02-25 20:16 ` [PATCH] git-compat-util.h: Provide missing netdb.h definitions Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEvUa7n_EsKnKQNuyvSiZW8s_rZv4oQrFNDX9wa_JSr_REj89w@mail.gmail.com \
    --to=fedora.dm0@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).