Re: Detecting glibc getopt?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: Detecting glibc getopt?
Date: 2001-10-20 11:46:23
Message-ID: Pine.LNX.4.30.0110201136380.827-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane writes:

> The reason we see this now, and didn't see it before, is that
> I rearranged startup to set the ps process title as soon as possible
> after forking a subprocess --- and at least on Linux machines, that
> "nextchar" pointer is pointing into the argv array that's overwritten
> by init_ps_display.

How about copying the entire argv[] array to a new location before the
very first call to getopt(). Then you can use getopt() without hackery
and can do anything you want to the "real" argv area. That should be a
lot safer. (We don't know yet what other platforms might play
optimization tricks in getopt().)

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron de Jong 2001-10-20 15:24:39 Re: Is there no "DESCRIBE <TABLE>;" on PGSQL? help!!!
Previous Message Peter Eisentraut 2001-10-20 11:46:15 Re: To Postgres Devs : Wouldn't changing the select limit