Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument - Mailing list pgsql-hackers

From qhwt@myrealbox.com
Subject Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Date
Msg-id 20030706153857.GA1495@myrealbox.com
Whole thread Raw
In response to PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument  (Kenji Sugita <sugita@srapc1327.sra.co.jp>)
Responses Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
List pgsql-hackers
Hi,

On Wed, Jul 02, 2003 at 03:49:19PM +0900, Kenji Sugita wrote:
> It seems that a value of addr->ai_socktype returned by getaddrinfo in
> pg_stat.c is not SOCK_DGRAM.

Please try the following untested patch:

--- pgstat.c.orig    Thu Jun 12 16:36:51 2003
+++ pgstat.c        Mon Jul  7 00:34:50 2003
@@ -194,10 +194,12 @@            gai_strerror(ret));        goto startup_failed;    }
-    
-    if ((pgStatSock = socket(addr->ai_family,
-        addr->ai_socktype, addr->ai_protocol)) < 0)
-    {
+
+    for (; addr != NULL; addr = addr->ai_next)
+        if ((pgStatSock = socket(addr->ai_family,
+            addr->ai_socktype, addr->ai_protocol)) >= 0)
+            break;
+    if (pgStatSock < 0) {        elog(LOG, "PGSTAT: socket() failed: %m");        goto startup_failed;    }




pgsql-hackers by date:

Previous
From: Carlos Guzman Alvarez
Date:
Subject: Re: Receiving data in binary format how is it encoded?
Next
From: qhwt@myrealbox.com
Date:
Subject: Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument