File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 42
42
* Portions Copyright (c) 1994, Regents of the University of California
43
43
* Portions taken from FreeBSD.
44
44
*
45
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.168 2009/02/25 13:03:06 petere Exp $
45
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.169 2009/03/31 18:58:16 mha Exp $
46
46
*
47
47
*-------------------------------------------------------------------------
48
48
*/
@@ -670,6 +670,13 @@ get_id(void)
670
670
progname );
671
671
exit (1 );
672
672
}
673
+ if (!pw )
674
+ {
675
+ fprintf (stderr ,
676
+ _ ("%s: could not obtain information about current user: %s\n" ),
677
+ progname , strerror (errno ));
678
+ exit (1 );
679
+ }
673
680
#else /* the windows code */
674
681
675
682
struct passwd_win32
@@ -681,7 +688,12 @@ get_id(void)
681
688
DWORD pwname_size = sizeof (pass_win32 .pw_name ) - 1 ;
682
689
683
690
pw -> pw_uid = 1 ;
684
- GetUserName (pw -> pw_name , & pwname_size );
691
+ if (!GetUserName (pw -> pw_name , & pwname_size ))
692
+ {
693
+ fprintf (stderr , _ ("%s: could not get current user name: %s\n" ),
694
+ progname , strerror (errno ));
695
+ exit (1 );
696
+ }
685
697
#endif
686
698
687
699
return xstrdup (pw -> pw_name );
You can’t perform that action at this time.
0 commit comments