mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Attached is a patch that takes care of the PATHSEP issue. I made a more
extensive change then what was suggested. I found the file path.c that contained a lot of "Unix/Windows" agnostic functions so I added a function there instead and removed the PATHSEP declaration in exec.c altogether. All to keep things from scattering all over the code. I also took the liberty of changing the name of the functions "first_path_sep" and "last_path_sep". Where I come from (and I'm apparently not alone given the former macro name PATHSEP), they should be called "first_dir_sep" and "last_dir_sep". The new function I introduced, that actually finds path separators, is now the "first_path_sep". The patch contains changes on all affected places of course. I also changed the documentation on dynamic_library_path to reflect the chagnes. Thomas Hallgren
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.134 2004/05/26 13:56:45 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.135 2004/06/10 22:26:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -941,7 +941,7 @@ resolve_alt_dbpath(const char *dbpath, Oid dboid)
|
||||
if (dbpath == NULL || dbpath[0] == '\0')
|
||||
return NULL;
|
||||
|
||||
if (first_path_separator(dbpath))
|
||||
if (first_dir_separator(dbpath))
|
||||
{
|
||||
if (!is_absolute_path(dbpath))
|
||||
ereport(ERROR,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.73 2004/05/26 18:35:39 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.74 2004/06/10 22:26:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -288,7 +288,7 @@ expand_dynamic_library_name(const char *name)
|
||||
|
||||
AssertArg(name);
|
||||
|
||||
have_slash = (first_path_separator(name) != NULL);
|
||||
have_slash = (first_dir_separator(name) != NULL);
|
||||
|
||||
if (!have_slash)
|
||||
{
|
||||
@@ -343,7 +343,7 @@ substitute_libpath_macro(const char *name)
|
||||
if (name[0] != '$')
|
||||
return pstrdup(name);
|
||||
|
||||
if ((sep_ptr = first_path_separator(name)) == NULL)
|
||||
if ((sep_ptr = first_dir_separator(name)) == NULL)
|
||||
sep_ptr = name + strlen(name);
|
||||
|
||||
if (strlen("$libdir") != sep_ptr - name ||
|
||||
@@ -374,7 +374,7 @@ find_in_dynamic_libpath(const char *basename)
|
||||
size_t baselen;
|
||||
|
||||
AssertArg(basename != NULL);
|
||||
AssertArg(first_path_separator(basename) == NULL);
|
||||
AssertArg(first_dir_separator(basename) == NULL);
|
||||
AssertState(Dynamic_library_path != NULL);
|
||||
|
||||
p = Dynamic_library_path;
|
||||
@@ -390,13 +390,17 @@ find_in_dynamic_libpath(const char *basename)
|
||||
char *mangled;
|
||||
char *full;
|
||||
|
||||
len = strcspn(p, ":");
|
||||
|
||||
if (len == 0)
|
||||
piece = first_path_separator(p);
|
||||
if(piece == p)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_NAME),
|
||||
errmsg("zero-length component in parameter \"dynamic_library_path\"")));
|
||||
|
||||
if(piece == 0)
|
||||
len = strlen(p);
|
||||
else
|
||||
len = piece - p;
|
||||
|
||||
piece = palloc(len + 1);
|
||||
strncpy(piece, p, len);
|
||||
piece[len] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user