aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-06-03 16:17:49 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-06-03 16:17:49 +0000
commita7a7f5caaaf97665c07d0323a339277c92a8fc83 (patch)
tree3375686d9a41a884c95498d5581ada0740a6b22f /src
parente5507631219392d08f327194c840e042e3577fc5 (diff)
downloadpostgresql-a7a7f5caaaf97665c07d0323a339277c92a8fc83.tar.gz
postgresql-a7a7f5caaaf97665c07d0323a339277c92a8fc83.zip
Change rather bizarre code ordering in get_id(). This isn't strictly
cosmetic --- I'm wondering if geteuid could have side effects on errno, thus possibly resulting in a misleading error message after failure of getpwuid.
Diffstat (limited to 'src')
-rw-r--r--src/bin/initdb/initdb.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index 6155b094727..3bb079840ab 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -42,7 +42,7 @@
* 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 $
*
*-------------------------------------------------------------------------
*/
@@ -654,8 +654,6 @@ get_id(void)
struct passwd *pw;
- pw = getpwuid(geteuid());
-
if (geteuid() == 0) /* 0 is root's uid */
{
fprintf(stderr,
@@ -666,6 +664,8 @@ get_id(void)
progname);
exit(1);
}
+
+ pw = getpwuid(geteuid());
if (!pw)
{
fprintf(stderr,