From: Alex Riesen Date: Tue, 12 Jun 2007 20:52:10 +0000 (+0200) Subject: Do not use h_errno after connect(2): the function does not set it X-Git-Tag: v1.5.3-rc0~86 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=v1.5.2.2-238-g7cbf2f2;p=git.git Do not use h_errno after connect(2): the function does not set it 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 Signed-off-by: Junio C Hamano --- diff --git a/connect.c b/connect.c index 7fab9c0fd..a5afd2a53 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;