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

From Kurt Roeckx
Subject Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument
Date
Msg-id 20030706163004.GA25464@ping.be
Whole thread Raw
In response to Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument  (qhwt@myrealbox.com)
Responses Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument  (Kurt Roeckx <Q@ping.be>)
List pgsql-hackers
On Mon, Jul 07, 2003 at 12:38:57AM +0900, qhwt@myrealbox.com wrote:
>
> 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:
[...]

> +    for (; addr != NULL; addr = addr->ai_next)
> +        if ((pgStatSock = socket(addr->ai_family,
> +            addr->ai_socktype, addr->ai_protocol)) >= 0)
> +            break;

This will break.  You should use a pointer to the addr, and go
over the list using that.

freeaddrinfo() needs to have the original addr back.

He seems to have 2 problems:
- On Mac OS X getaddrinfo() returns something it shouldn't.
  A patch like that could fix it.
- On Linux Redhat 6.2 (and 6.0) getaddrinfo() seems to have a
  problem with AI_ADDRCONFIG.  Which is also used in
  StreamServerPort().  So he won't be able to listen to any
  socket there either.

Not being able to use AI_ADDRCONFIG is rather annoying, but I
guess if we just try all the returned addresses until 1 works
will have to do.

Try the attached patch instead.


Kurt


Attachment

pgsql-hackers by date:

Previous
From: "Francisco Figueiredo Jr."
Date:
Subject: Re: Receiving data in binary format how is it encoded?
Next
From: Kurt Roeckx
Date:
Subject: Re: PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument