summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-06-03 16:17:49 +0000
committerTom Lane2009-06-03 16:17:49 +0000
commit6fba39e7ab1392d4b2a992f183372e656b19dfe4 (patch)
tree8873ac3d04e412c9edbb83b446eeaa6bb698560f
parent3f3cd75858f7017a4167d3816e2c47da2f1ec06a (diff)
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.
-rw-r--r--src/bin/initdb/initdb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index bc3837630a..9d95efd027 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -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,