Skip to content

Commit 79f9ee9

Browse files
committed
Fix core dumps, inability to count, etc associated with canonicalize_path
patches.
1 parent d785841 commit 79f9ee9

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/backend/utils/fmgr/dfmgr.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.75 2004/07/12 02:22:49 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.76 2004/08/13 14:47:23 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -405,10 +405,11 @@ find_in_dynamic_libpath(const char *basename)
405405
strncpy(piece, p, len);
406406
piece[len] = '\0';
407407

408-
canonicalize_path(piece);
409408
mangled = substitute_libpath_macro(piece);
410409
pfree(piece);
411410

411+
canonicalize_path(mangled);
412+
412413
/* only absolute paths */
413414
if (!is_absolute_path(mangled))
414415
ereport(ERROR,

src/bin/psql/command.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.122 2004/07/15 03:56:06 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.123 2004/08/13 14:47:23 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "command.h"
@@ -375,7 +375,8 @@ exec_command(const char *cmd,
375375
fname = psql_scan_slash_option(scan_state,
376376
OT_NORMAL, NULL, true);
377377
expand_tilde(&fname);
378-
canonicalize_path(fname);
378+
if (fname)
379+
canonicalize_path(fname);
379380
status = do_edit(fname, query_buf) ? CMD_NEWEDIT : CMD_ERROR;
380381
free(fname);
381382
}

src/bin/psql/copy.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.50 2004/07/11 21:34:03 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.51 2004/08/13 14:47:23 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "copy.h"
@@ -513,7 +513,8 @@ do_copy(const char *args)
513513
appendPQExpBuffer(&query, " FORCE NOT NULL %s", options->force_notnull_list);
514514
}
515515

516-
canonicalize_path(options->file);
516+
if (options->file)
517+
canonicalize_path(options->file);
517518

518519
if (options->from)
519520
{

src/port/path.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/port/path.c,v 1.29 2004/08/12 19:03:44 momjian Exp $
11+
* $PostgreSQL: pgsql/src/port/path.c,v 1.30 2004/08/13 14:47:23 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -335,7 +335,7 @@ set_pglocale_pgservice(const char *argv0, const char *app)
335335
{
336336
char path[MAXPGPATH];
337337
char my_exec_path[MAXPGPATH];
338-
char env_path[MAXPGPATH + sizeof("PGLOCALEDIR=")]; /* longer than PGSYSCONFDIR */
338+
char env_path[MAXPGPATH + sizeof("PGSYSCONFDIR=")]; /* longer than PGLOCALEDIR */
339339

340340
/* don't set LC_ALL in the backend */
341341
if (strcmp(app, "postgres") != 0)
@@ -353,7 +353,7 @@ set_pglocale_pgservice(const char *argv0, const char *app)
353353
{
354354
/* set for libpq to use */
355355
snprintf(env_path, sizeof(env_path), "PGLOCALEDIR=%s", path);
356-
canonicalize_path(env_path);
356+
canonicalize_path(env_path + 12);
357357
putenv(strdup(env_path));
358358
}
359359
#endif
@@ -364,7 +364,7 @@ set_pglocale_pgservice(const char *argv0, const char *app)
364364

365365
/* set for libpq to use */
366366
snprintf(env_path, sizeof(env_path), "PGSYSCONFDIR=%s", path);
367-
canonicalize_path(env_path);
367+
canonicalize_path(env_path + 13);
368368
putenv(strdup(env_path));
369369
}
370370
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy