Re: Detecting glibc getopt?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Detecting glibc getopt?
Дата
Msg-id 12747.1003595602@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Detecting glibc getopt?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> 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().)

Well, mumble --- strictly speaking, there is *NO* way to use getopt
over multiple cycles "without hackery".  The standard for getopt
(http://www.opengroup.org/onlinepubs/7908799/xsh/getopt.html)
doesn't say you're allowed to scribble on optind in the first place.
But you're probably right that having a read-only copy of the argv
vector will make things safer.  Will do it that way.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Serguei Mokhov"
Дата:
Сообщение: Re: namespaces
Следующее
От: Bill Studenmund
Дата:
Сообщение: Re: Package support for Postgres