Re: [HACKERS] Proposed patch to getaddrinfo.c to support

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: [HACKERS] Proposed patch to getaddrinfo.c to support
Дата
Msg-id 430F982F.2030509@dunslane.net
обсуждение исходный текст
Ответ на Re: [HACKERS] Proposed patch to getaddrinfo.c to support  (Petr Jelinek <pjmodos@seznam.cz>)
Ответы Re: [HACKERS] Proposed patch to getaddrinfo.c to support  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches

Petr Jelinek wrote:

>
> So I hope IPv6 episode is finally over :)
>

Almost :-)

The initdb code is failing because we didn't call WSAStartup() - this
just took me ages to track down. All the rest works.

The attached patch seems to do the trick.

cheers

andrew


Index: initdb.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/initdb/initdb.c,v
retrieving revision 1.96
diff -c -r1.96 initdb.c
*** initdb.c    25 Aug 2005 02:22:59 -0000    1.96
--- initdb.c    26 Aug 2005 22:28:48 -0000
***************
*** 1221,1226 ****
--- 1221,1237 ----
      {
          struct addrinfo *gai_result;
          struct addrinfo hints;
+         int err = 0;
+
+ #ifdef WIN32
+         /* need to call this before calling getaddrinfo */
+
+         WSADATA    wsaData;
+
+         err = WSAStartup(MAKEWORD(2,2),&wsaData);
+
+ #endif;
+

          /* for best results, this code should match parse_hba() */
          hints.ai_flags = AI_NUMERICHOST;
***************
*** 1232,1238 ****
          hints.ai_addr = NULL;
          hints.ai_next = NULL;

!         if (getaddrinfo("::1", NULL, &hints, &gai_result) != 0)
              conflines = replace_token(conflines,
                                        "host    all         all         ::1",
                                        "#host    all         all         ::1");
--- 1243,1249 ----
          hints.ai_addr = NULL;
          hints.ai_next = NULL;

!         if ( err != 0 || getaddrinfo("::1", NULL, &hints, &gai_result) != 0)
              conflines = replace_token(conflines,
                                        "host    all         all         ::1",
                                        "#host    all         all         ::1");

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: force C locale for temp regression installations
Следующее
От: "Matt A."
Дата:
Сообщение: insert into table (column) values (nullif('',''));