| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:message-id:date:from:mime-version:to:subject | |
| :content-type; q=dns; s=default; b=m+YOGX1PIhFq8qKuBiWE1yfcMBVwf | |
| HFlG9XvqeDGAjwr5h2jO5lfon4G4E63DQcgEQfTD7/TN9NpJhUBkw7rKbGDK9bKu | |
| QpabUyIzlxYQDcj4ExnQVV37ElJ5SCsuZcGqLQCsTUkSr4kZah2OiKib5aLtQI/s | |
| /OWsHaEKGT8M88= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:message-id:date:from:mime-version:to:subject | |
| :content-type; s=default; bh=jS4XY0rfpIb0ow/O+HP7WmoDCmc=; b=wIR | |
| pcGoyHxbpnDxAOoY0avXbmXprN8dZjeFptxi9Atw6Kb7K4CLAuD7hrxCfJPjzNs4 | |
| ZcW5vdgdBHcNLXD0AS/XRdE68fdnS3oxj/xE8AMj0FpWPM6jUwQHwevf1CCWVWSq | |
| Cbj2ZraD0eA55Mp43S3iaNZoRJ/Rsh5xXrwymRMY= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-1.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 |
| X-HELO: | mail-we0-f181.google.com |
| X-Received: | by 10.194.92.177 with SMTP id cn17mr14203040wjb.71.1403523681093; Mon, 23 Jun 2014 04:41:21 -0700 (PDT) |
| Message-ID: | <53A81259.4080300@gmail.com> |
| Date: | Mon, 23 Jun 2014 13:41:13 +0200 |
| From: | Marco Atzeri <marco DOT atzeri AT gmail DOT com> |
| User-Agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
| MIME-Version: | 1.0 |
| To: | "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com> |
| Subject: | getaddrinfo : Non-recoverable failure in name resolution |
| X-IsSubscribed: | yes |
--------------050708090609080501000206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
the attached two test programs should perform exactly the same call
to getaddrinfo for 127.0.0.1
however on 32 bit
CYGWIN_NT-6.1-WOW64 1.7.30(0.272/5/3) 2014-05-23 10:36 i686 Cygwin
32 $ ./getaddrinfo_test-1_32
127.0.0.1 ai_addr
02 00 00 00 7f 00 00 01 00 00 00 00 00 00 00 00
32 $ ./getaddrinfo_test-2_32
127.0.0.1 ai_addr
02 00 00 00 7f 00 00 01 00 00 00 00 00 00 00 00
while on 64 bit
CYGWIN_NT-6.1 1.7.30(0.272/5/3) 2014-05-23 10:36 x86_64 Cygwin
64 $ ./getaddrinfo_test-1_64
127.0.0.1 ai_addr
02 00 00 00 7f 00 00 01 00 00 00 00 00 00 00 00
64 $ ./getaddrinfo_test-2_64
getaddrinfo: Non-recoverable failure in name resolution
Am I missing something ?
The second way is currently used on postgresql in several places,
but it seems to fail only for "127.0.0.1"
Regards
Marco
--------------050708090609080501000206
Content-Type: text/plain; charset=windows-1252;
name="getaddrinfo_test-1.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="getaddrinfo_test-1.c"
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int rc,i,l;
const char *hostname="127.0.0.1";
const char *servname="";
struct addrinfo *hintp;
/* struct addrinfo *resultp; */
struct addrinfo **result;
char *addr;
hintp=calloc(1,sizeof(struct addrinfo ));
/*
resultp=calloc(1,sizeof(struct addrinfo ));
result=&resultp;
*/
hintp->ai_flags = 4;
hintp->ai_family = 0;
hintp->ai_socktype = 0;
hintp->ai_protocol = 0;
hintp->ai_addrlen = 0;
hintp->ai_canonname = 0x0;
hintp->ai_addr = 0x0;
hintp->ai_next = 0x0;
rc = getaddrinfo(hostname, servname, hintp, result);
if (!rc)
{
printf("127.0.0.1 ai_addr\n");
l=(*result)->ai_addrlen;
addr=(char*)(*result)->ai_addr;
for(i=0;i<l;i++)
printf("%2.2x ",addr[i]);
printf("\n");
}
else
{
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rc));
exit(EXIT_FAILURE);
}
}
--------------050708090609080501000206
Content-Type: text/plain; charset=windows-1252;
name="getaddrinfo_test-2.c"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="getaddrinfo_test-2.c"
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int rc,i,l;
const char *hostname="127.0.0.1";
const char *servname="";
struct addrinfo hintp;
/* struct addrinfo *resultp; */
struct addrinfo *result=NULL;
char *addr;
/*
hintp=calloc(1,sizeof(struct addrinfo ));
resultp=calloc(1,sizeof(struct addrinfo ));
result=&resultp;
*/
hintp.ai_flags = 4;
hintp.ai_family = 0;
hintp.ai_socktype = 0;
hintp.ai_protocol = 0;
hintp.ai_addrlen = 0;
hintp.ai_canonname = 0x0;
hintp.ai_addr = 0x0;
hintp.ai_next = 0x0;
rc = getaddrinfo(hostname, servname, &hintp, &result);
if (!rc)
{
printf("127.0.0.1 ai_addr\n");
l=result->ai_addrlen;
addr=(char*)result->ai_addr;
for(i=0;i<l;i++)
printf("%2.2x ",addr[i]);
printf("\n");
}
else
{
fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rc));
exit(EXIT_FAILURE);
}
}
--------------050708090609080501000206
Content-Type: text/plain; charset=us-ascii
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--------------050708090609080501000206--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |