cosmetic --- I'm wondering if geteuid could have side effects on errno,
thus possibly resulting in a misleading error message after failure of
getpwuid.
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.170 2009/04/05 04:19:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.171 2009/06/03 16:17:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
struct passwd *pw;
- pw = getpwuid(geteuid());
-
if (geteuid() == 0) /* 0 is root's uid */
{
fprintf(stderr,
progname);
exit(1);
}
+
+ pw = getpwuid(geteuid());
if (!pw)
{
fprintf(stderr,