From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9181 invoked by alias); 23 Jun 2014 11:42:05 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 9169 invoked by uid 89); 23 Jun 2014 11:42:04 -0000 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 Received: from mail-we0-f181.google.com (HELO mail-we0-f181.google.com) (74.125.82.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 23 Jun 2014 11:41:24 +0000 Received: by mail-we0-f181.google.com with SMTP id q59so6754781wes.40 for ; Mon, 23 Jun 2014 04:41:21 -0700 (PDT) X-Received: by 10.194.92.177 with SMTP id cn17mr14203040wjb.71.1403523681093; Mon, 23 Jun 2014 04:41:21 -0700 (PDT) Received: from [172.21.188.197] ([62.154.173.198]) by mx.google.com with ESMTPSA id r9sm32636372wia.17.2014.06.23.04.41.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 04:41:20 -0700 (PDT) Message-ID: <53A81259.4080300@gmail.com> Date: Mon, 23 Jun 2014 11:42:00 -0000 From: Marco Atzeri 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@cygwin.com" Subject: getaddrinfo : Non-recoverable failure in name resolution Content-Type: multipart/mixed; boundary="------------050708090609080501000206" X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg00350.txt.bz2 --------------050708090609080501000206 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 795 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" Content-length: 909 #include #include #include #include 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 #include #include #include 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