diff options
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r-- | src/bin/psql/startup.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index ef84d9410b6..1ab0ac85243 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.64 2002/09/04 20:31:36 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.65 2002/09/05 22:05:50 momjian Exp $ */ #include "postgres_fe.h" @@ -42,6 +42,7 @@ */ PsqlSettings pset; +#define PSQLRC "/.psqlrc" /* * Structures to pass information between the option parsing routine @@ -604,19 +605,20 @@ process_psqlrc(void) if (home) { - psqlrc = malloc(strlen(home) + 20); + psqlrc = malloc(strlen(home) + strlen(PSQLRC) + 1 + + strlen(PG_VERSION) + 1); if (!psqlrc) { fprintf(stderr, gettext("%s: out of memory\n"), pset.progname); exit(EXIT_FAILURE); } - sprintf(psqlrc, "%s/.psqlrc-" PG_VERSION, home); + sprintf(psqlrc, "%s" PSQLRC "-" PG_VERSION, home); if (access(psqlrc, R_OK) == 0) process_file(psqlrc); else { - sprintf(psqlrc, "%s/.psqlrc", home); + sprintf(psqlrc, "%s" PSQLRC, home); if (access(psqlrc, R_OK) == 0) process_file(psqlrc); } |