diff options
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 092678604ed..c5ec9819ea1 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2052,10 +2052,10 @@ process_file(char *filename, bool single_txn, bool use_relative_path) * relative pathname, then prepend all but the last pathname component * of the current script to this pathname. */ - if (use_relative_path && pset.inputfile && !is_absolute_path(filename) - && !has_drive_prefix(filename)) + if (use_relative_path && pset.inputfile && + !is_absolute_path(filename) && !has_drive_prefix(filename)) { - snprintf(relpath, MAXPGPATH, "%s", pset.inputfile); + strlcpy(relpath, pset.inputfile, sizeof(relpath)); get_parent_directory(relpath); join_path_components(relpath, relpath, filename); canonicalize_path(relpath); |