summaryrefslogtreecommitdiff
path: root/src/bin/psql/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r--src/bin/psql/common.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 681c88cc4e7..40316c5d8a7 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.87 2004/05/23 22:20:10 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.88 2004/08/18 02:59:11 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -1078,13 +1078,13 @@ expand_tilde(char **filename)
if (**filename == '~')
{
char *fn;
- char *home;
char oldp,
*p;
struct passwd *pw;
+ char home[MAXPGPATH];
fn = *filename;
- home = NULL;
+ *home = '\0';
p = fn + 1;
while (*p != '/' && *p != '\0')
@@ -1094,12 +1094,12 @@ expand_tilde(char **filename)
*p = '\0';
if (*(fn + 1) == '\0')
- home = getenv("HOME");
+ get_home_path(home);
else if ((pw = getpwnam(fn + 1)) != NULL)
- home = pw->pw_dir;
+ StrNCpy(home, pw->pw_dir, MAXPGPATH);
*p = oldp;
- if (home)
+ if (strlen(home) != 0)
{
char *newfn;