psql_fix_ir.v2.diff
application/octet-stream
Filename: psql_fix_ir.v2.diff
Type: application/octet-stream
Part: 0
Message:
psql \ir filename normalization
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
Series: patch v2
| File | + | − |
|---|---|---|
| src/bin/psql/command.c | 0 | 0 |
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
new file mode 100644
index 9cc73be..b3acb27
*** a/src/bin/psql/command.c
--- b/src/bin/psql/command.c
*************** process_file(char *filename, bool single
*** 2020,2031 ****
if (use_relative_path && pset.inputfile && !is_absolute_path(filename)
&& !has_drive_prefix(filename))
{
! snprintf(relpath, MAXPGPATH, "%s", pset.inputfile);
! get_parent_directory(relpath);
! join_path_components(relpath, relpath, filename);
! canonicalize_path(relpath);
! filename = relpath;
}
fd = fopen(filename, PG_BINARY_R);
--- 2020,2053 ----
if (use_relative_path && pset.inputfile && !is_absolute_path(filename)
&& !has_drive_prefix(filename))
{
! char *last_slash;
! /* find the / that splits the file from its path */
! last_slash = strrchr(pset.inputfile, '/');
!
! if (last_slash)
! {
! size_t dir_len = (last_slash - pset.inputfile) + 1;
!
! /* Check to make sure we won't overflow the array boundaries
! * of relpath.
! */
! if (dir_len + strlen(filename) >= MAXPGPATH)
! {
! psql_error("Filename(s) too long: %s %s\n", pset.inputfile, filename);
! return EXIT_FAILURE;
! }
!
! /* Construct an absolute filename relative to the directory
! * containing pset.inputfile.
! */
! relpath[0] = '\0';
! strncat(relpath, pset.inputfile, dir_len);
! strcat(relpath, filename);
!
! canonicalize_path(relpath);
! filename = relpath;
! }
}
fd = fopen(filename, PG_BINARY_R);