Re: 7.1beta4 initdb problem - Mailing list pgsql-general

From Peter Eisentraut
Subject Re: 7.1beta4 initdb problem
Date
Msg-id Pine.LNX.4.30.0102052203360.762-100000@peter.localdomain
Whole thread Raw
In response to Re: 7.1beta4 initdb problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Alfred Perlstein
Date:
Subject: Re: Longer and longer updates
Next
From: Andrew Gould
Date:
Subject: Re: Write to postgreSQL via ODBC?