*** pgsql/src/bin/initdb/initdb.c 2008/10/30 08:51:13 1.152.2.4 --- pgsql/src/bin/initdb/initdb.c 2009/03/31 18:58:38 1.152.2.5 *************** *** 42,48 **** * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * ! * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.152.2.3 2008/06/02 03:48:07 tgl Exp $ * *------------------------------------------------------------------------- */ --- 42,48 ---- * Portions Copyright (c) 1994, Regents of the University of California * Portions taken from FreeBSD. * ! * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.152.2.4 2008/10/30 08:51:13 petere Exp $ * *------------------------------------------------------------------------- */ *************** get_id(void) *** 673,678 **** --- 673,685 ---- progname); exit(1); } + if (!pw) + { + fprintf(stderr, + _("%s: could not obtain information about current user: %s\n"), + progname, strerror(errno)); + exit(1); + } #else /* the windows code */ struct passwd_win32 *************** get_id(void) *** 684,690 **** DWORD pwname_size = sizeof(pass_win32.pw_name) - 1; pw->pw_uid = 1; ! GetUserName(pw->pw_name, &pwname_size); #endif return xstrdup(pw->pw_name); --- 691,702 ---- DWORD pwname_size = sizeof(pass_win32.pw_name) - 1; pw->pw_uid = 1; ! if (!GetUserName(pw->pw_name, &pwname_size)) ! { ! fprintf(stderr, _("%s: could not get current user name: %s\n"), ! progname, strerror(errno)); ! exit(1); ! } #endif return xstrdup(pw->pw_name);