git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Riesen <raa.lkml@gmail.com>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Cc: git@vger.kernel.org, Junio C Hamano <junkio@cox.net>
Subject: [PATCH] Do not use h_errno after connect(2): the function does not set it
Date: Tue, 12 Jun 2007 22:52:10 +0200	[thread overview]
Message-ID: <20070612205210.GC2459@steel.home> (raw)
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

  parent reply	other threads:[~2007-06-12 20:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 16:13 [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322 Randal L. Schwartz
2007-06-12 20:03 ` Alex Riesen
2007-06-12 20:52 ` Alex Riesen [this message]
2007-06-12 21:31   ` [PATCH] Add a local implementation of hstrerror for the system which do not have it Alex Riesen
2007-06-13  7:05     ` Johannes Sixt
     [not found]       ` <81b0412b0706130051l570e6ab7y48d6eea8c6b2d97e@mail.gmail.com>
2007-06-13 18:54         ` Alex Riesen
2007-06-16 15:21           ` Randal L. Schwartz
2007-06-18 21:28     ` Brandon Casey
2007-06-18 21:34       ` Brandon Casey
2007-06-18 21:37       ` Alex Riesen
2007-06-18 21:53         ` Brandon Casey

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=20070612205210.GC2459@steel.home \
    --to=raa.lkml@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    --cc=merlyn@stonehenge.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).