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

[PATCH] Do not use h_errno after connect(2): the function does not set it

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jun 12, 2007, 20:52 UTC
Message-ID
<20070612205210.GC2459@steel.home>
In-Reply-To
<86ejkh40cr.fsf@blue.stonehenge.com>

Randal L. Schwartz noticed compilation problems on SunOS, which made me look at the code again. The thing is, h_errno is not used by connect(2), it is only for functions from netdb.h, like gethostbyname.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---

This must fix your link problems (unless you want to use NO_IPV6=1, where another fix will be posted in a minute).

 connect.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/connect.c b/connect.c
index 7fab9c0..a5afd2a 100644
--- a/connect.c
+++ b/connect.c
@@ -224,11 +224,10 @@ static int git_tcp_connect_sock(char *host, int flags)
 		}
 		if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {
 			saved_errno = errno;
-			fprintf(stderr, "%s[%d: %s]: net=%s, errno=%s\n",
+			fprintf(stderr, "%s[%d: %s]: errno=%s\n",
 				host,
 				cnt,
 				ai_name(ai),
-				hstrerror(h_errno),
 				strerror(saved_errno));
 			close(sockfd);
 			sockfd = -1;
@@ -315,11 +314,10 @@ static int git_tcp_connect_sock(char *host, int flags)
 
 		if (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {
 			saved_errno = errno;
-			fprintf(stderr, "%s[%d: %s]: net=%s, errno=%s\n",
+			fprintf(stderr, "%s[%d: %s]: errno=%s\n",
 				host,
 				cnt,
 				inet_ntoa(*(struct in_addr *)&sa.sin_addr),
-				hstrerror(h_errno),
 				strerror(saved_errno));
 			close(sockfd);
 			sockfd = -1;
-- 
1.5.2.1.191.gc01a
Previous: Alex RiesenNext: Alex Riesen
Message 3 of 11 in “[BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322”
  1. Randal L. SchwartzJun 12, 2007
  2. Alex RiesenJun 12, 2007
  3. Do not use h_errno after connect(2): the function does not set itAlex Riesen, Jun 12, 2007
  4. Add a local implementation of hstrerror for the system which do not have itAlex Riesen, Jun 12, 2007
  5. Johannes SixtJun 13, 2007
  6. Brandon CaseyJun 18, 2007
  7. Brandon CaseyJun 18, 2007
  8. Alex RiesenJun 18, 2007
  9. Brandon CaseyJun 18, 2007
  10. Add a local implementation of hstrerror for the system which do not have itAlex Riesen, Jun 13, 2007
  11. Randal L. SchwartzJun 16, 2007

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.