aboutsummaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2004-07-11 21:34:04 +0000
committerBruce Momjian <bruce@momjian.us>2004-07-11 21:34:04 +0000
commit7b0f060d549524b39e97b4dcacd775f948ff55c6 (patch)
tree1ee43a2f47eae82e5beb0d15ebaf2e14615f290d /src/bin/psql/command.c
parent8801110b20c6bffe4724e7b27de1c5e519af1b04 (diff)
downloadpostgresql-7b0f060d549524b39e97b4dcacd775f948ff55c6.tar.gz
postgresql-7b0f060d549524b39e97b4dcacd775f948ff55c6.zip
Use canonicalize_path for -D, GUC paths, and paths coming in from
environment variables.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 9b45b96bbf4..ba8d623731c 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.119 2004/07/11 13:29:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.120 2004/07/11 21:34:03 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -375,6 +375,7 @@ exec_command(const char *cmd,
fname = psql_scan_slash_option(scan_state,
OT_NORMAL, NULL, true);
expand_tilde(&fname);
+ canonicalize_path(fname);
status = do_edit(fname, query_buf) ? CMD_NEWEDIT : CMD_ERROR;
free(fname);
}
@@ -777,8 +778,10 @@ exec_command(const char *cmd,
fd = popen(&fname[1], "w");
}
else
+ {
+ canonicalize_path(fname);
fd = fopen(fname, "w");
-
+ }
if (!fd)
{
psql_error("%s: %s\n", fname, strerror(errno));
@@ -1122,7 +1125,6 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
if (filename_arg)
fname = filename_arg;
-
else
{
/* make a temp file to edit */
@@ -1262,6 +1264,7 @@ process_file(char *filename)
if (!filename)
return false;
+ canonicalize_path(filename);
fd = fopen(filename, PG_BINARY_R);
if (!fd)