Re: 7.1beta4 initdb problem

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tim Barnard <tbarnard(at)povn(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: 7.1beta4 initdb problem
Date: 2001-02-05 21:08:28
Message-ID: Pine.LNX.4.30.0102052203360.762-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://yi.org/peter-e/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emmanuel Charpentier 2001-02-05 21:24:45 Re: Debian packages of 7.1beta4 available
Previous Message Alfred Perlstein 2001-02-05 20:52:38 Re: [GENERAL] Longer and longer updates