Re: 7.1beta4 initdb problem

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: 7.1beta4 initdb problem
Дата
Msg-id Pine.LNX.4.30.0102052203360.762-100000@peter.localdomain
обсуждение исходный текст
Ответ на Re: 7.1beta4 initdb problem  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane writes:

> Um.  Okay then, the alternatives are
>
> (1) move the handling of --version out of PostgresMain and friends, and
> put it into main.c before the are-we-root check;
>
> (2) move the are-we-root check out of main.c and duplicate it in
> PostgresMain and friends.
>
> Which choice do you like best?

Let them meet in the middle. ;-)  If the option is --version or --help,
ignore the root test.

I would have opted for (1), but it would be nice to be able to see the
help as root, too, and I don't want to move that.


diff -U2 -r1.40 main.c
--- main.c      2001/01/24 19:42:56     1.40
+++ main.c      2001/02/05 20:58:50
@@ -110,5 +110,8 @@
        */
 #ifndef __BEOS__
-       if (geteuid() == 0)
+       if (!(argc > 1
+                 && ( strcmp(argv[1], "--help")==0 || strcmp(argv[1], "-?")==0
+                          || strcmp(argv[1], "--version")==0 || strcmp(argv[1], "-V")==0 ))
+               && (geteuid() == 0) )
        {
                fprintf(stderr, "%s", NOROOTEXEC);

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


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

Предыдущее
От: Alfred Perlstein
Дата:
Сообщение: Re: Longer and longer updates
Следующее
От: Andrew Gould
Дата:
Сообщение: Re: Write to postgreSQL via ODBC?