git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: compile error in Git v2.7.0-rc0

From
Jeff King <peff@peff.net>
Date
Dec 14, 2015, 20:52 UTC
Message-ID
<20151214205241.GB14788@sigill.intra.peff.net>
In-Reply-To
<20151214204624.GA14788@sigill.intra.peff.net>
On Mon, Dec 14, 2015 at 03:46:25PM -0500, Jeff King wrote:
> I don't think that fix is right, though. We should be passing "host" to
> gethostbyname.
Here it is in patch form. It can go on top of ep/ident-with-getaddrinfo.
-- >8 --
Subject: [PATCH] ident: fix undefined variable when NO_IPV6 is set

Commit 00bce77 (ident.c: add support for IPv6, 2015-11-27) moved the "gethostbyname" call out of "add_domainname" and into the helper function "canonical_name". But when moving the code, it forgot that the "buf" variable is passed as "host" in the helper.

Reported-by: johan defries <johandefries@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
---
 ident.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ident.c b/ident.c
index 4e7f99d..00a62e0 100644
--- a/ident.c
+++ b/ident.c
@@ -86,7 +86,7 @@ static int canonical_name(const char *host, struct strbuf *out)
 		freeaddrinfo(ai);
 	}
 #else
-	struct hostent *he = gethostbyname(buf);
+	struct hostent *he = gethostbyname(host);
 	if (he && strchr(he->h_name, '.')) {
 		strbuf_addstr(out, he->h_name);
 		status = 0;
-- 
2.7.0.rc0.348.g8e7037f
Previous: Jeff KingNext: Junio C Hamano
Message 4 of 5 in “compile error in Git v2.7.0-rc0”
  1. johan defriesDec 14, 2015
  2. Junio C HamanoDec 14, 2015
  3. Jeff KingDec 14, 2015
  4. Jeff KingDec 14, 2015
  5. Junio C HamanoDec 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.