Re: Detecting glibc getopt? - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Detecting glibc getopt?
Date
Msg-id Pine.LNX.4.30.0110201136380.827-100000@peter.localdomain
Whole thread Raw
In response to Detecting glibc getopt?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Detecting glibc getopt?
List 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@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Jean-Michel POURE
Date:
Subject: Re: Packages are needed
Next
From: Chris Bitmead
Date:
Subject: Unable to upgrade to 7.2