aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r--src/bin/psql/startup.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index a0640b1836c..b21beeb758c 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.81 2003/11/29 19:52:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.82 2004/01/24 19:38:49 neilc Exp $
*/
#include "postgres_fe.h"
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
if (strcmp(options.username, "\001") == 0)
username = simple_prompt("User name: ", 100, true);
else
- username = strdup(options.username);
+ username = xstrdup(options.username);
}
if (pset.getPassword)
@@ -567,15 +567,10 @@ process_psqlrc(void)
if (home)
{
- psqlrc = malloc(strlen(home) + 1 + strlen(PSQLRC) + 1 +
- strlen(PG_VERSION) + 1);
- if (!psqlrc)
- {
- fprintf(stderr, gettext("%s: out of memory\n"), pset.progname);
- exit(EXIT_FAILURE);
- }
-
+ psqlrc = xmalloc(strlen(home) + 1 + strlen(PSQLRC) + 1 +
+ strlen(PG_VERSION) + 1);
sprintf(psqlrc, "%s/%s-%s", home, PSQLRC, PG_VERSION);
+
if (access(psqlrc, R_OK) == 0)
process_file(psqlrc);
else