Bug in postgresql-6.3.2

Started by Nonameover 27 years ago3 messages
#1Noname
Hamish.N.MARSON@British-Airways.com

Quick note... Just to say that I found a bug in postgres 6.3.2 that I just this
minute downloaded from the ftp site... It doesn't compile under AIX 4.2.1 with
the latest C for AIX ver 3.1.4

It's only aminor problem, some of the variables in pqcomm.c are declared as
int, and being passed to functions that expect a long * variable (Actually the
function paramaters are declared as size_t).

The fix is to change the addrlen variable used on line 673 to a size_t instead
of an int, and also for the len variable used on line 787.

Sorry... No diffs... No time, and I dont' subscribe to the list... I just like
postgres (Maybe I'll subscribe one day... Too busy at the moment).

TIA.

hamish.

----------------------- External Addressing ----------------------
-----------------------------------------------------------------------------

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Noname (#1)
Re: [HACKERS] Bug in postgresql-6.3.2

Quick note... Just to say that I found a bug in postgres 6.3.2 that I just this
minute downloaded from the ftp site... It doesn't compile under AIX 4.2.1 with
the latest C for AIX ver 3.1.4

It's only aminor problem, some of the variables in pqcomm.c are declared as
int, and being passed to functions that expect a long * variable (Actually the
function paramaters are declared as size_t).

The fix is to change the addrlen variable used on line 673 to a size_t instead
of an int, and also for the len variable used on line 787.

Sorry... No diffs... No time, and I dont' subscribe to the list... I just like
postgres (Maybe I'll subscribe one day... Too busy at the moment).

The line you are complaining about is:

if ((port->sock = accept(server_fd,
(struct sockaddr *) & port->raddr,
&addrlen)) < 0)

while BSDI has accept defined as:

int accept(int s, struct sockaddr *addr, int *addrlen);

So AIX has the last parameter defined as size_t, huh? I looked at the
accept manual page, and addrlen is the length of the addr field. Hard
to imagine that is ever going to be larger than an int. Does any other
OS have that third parameter as anything but an int*?

We may need to add some aix-specific check on a configure check for
this.

-- 
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)
#3Stupor Genius
stuporg@erols.com
In reply to: Bruce Momjian (#2)
RE: [HACKERS] Bug in postgresql-6.3.2

The line you are complaining about is:

if ((port->sock = accept(server_fd,
(struct sockaddr *) & port->raddr,
&addrlen)) < 0)

while BSDI has accept defined as:

int accept(int s, struct sockaddr *addr, int *addrlen);

So AIX has the last parameter defined as size_t, huh? I looked at the
accept manual page, and addrlen is the length of the addr field. Hard
to imagine that is ever going to be larger than an int. Does any other
OS have that third parameter as anything but an int*?

We may need to add some aix-specific check on a configure check for
this.

From aix 4.1 to 4.2, it changed from an int* to an unsigned long*, which

is probably what size_t is defined as.

Wasn't just accept() though. There were other socket functions, but I
don't recall the names offhand. Not around aix anymore either... :)

Check thru the questions digests. I helped a couple of people compile
past this glitch, latest being Jim Kraii I believe.

darrenk