Skip to content

Commit a7a7f5c

Browse files
committed
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.
1 parent e550763 commit a7a7f5c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bin/initdb/initdb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
* Portions taken from FreeBSD.
4444
*
45-
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.170 2009/04/05 04:19:58 tgl Exp $
45+
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.171 2009/06/03 16:17:49 tgl Exp $
4646
*
4747
*-------------------------------------------------------------------------
4848
*/
@@ -654,8 +654,6 @@ get_id(void)
654654

655655
struct passwd *pw;
656656

657-
pw = getpwuid(geteuid());
658-
659657
if (geteuid() == 0) /* 0 is root's uid */
660658
{
661659
fprintf(stderr,
@@ -666,6 +664,8 @@ get_id(void)
666664
progname);
667665
exit(1);
668666
}
667+
668+
pw = getpwuid(geteuid());
669669
if (!pw)
670670
{
671671
fprintf(stderr,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy