mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +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:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/exec.c,v 1.15 2004/05/24 22:35:37 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/exec.c,v 1.16 2004/06/10 22:26:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -28,13 +28,6 @@
|
||||
|
||||
#define _(x) gettext(x)
|
||||
|
||||
/* $PATH (or %PATH%) path separator */
|
||||
#ifdef WIN32
|
||||
#define PATHSEP ';'
|
||||
#else
|
||||
#define PATHSEP ':'
|
||||
#endif
|
||||
|
||||
#ifndef S_IRUSR /* XXX [TRH] should be in a header */
|
||||
#define S_IRUSR S_IREAD
|
||||
#define S_IWUSR S_IWRITE
|
||||
@ -196,7 +189,7 @@ find_my_exec(const char *argv0, char *retpath)
|
||||
* it).
|
||||
*/
|
||||
/* Does argv0 have a separator? */
|
||||
if ((path = last_path_separator(argv0)))
|
||||
if ((path = last_dir_separator(argv0)))
|
||||
{
|
||||
if (*++path == '\0')
|
||||
{
|
||||
@ -247,7 +240,7 @@ find_my_exec(const char *argv0, char *retpath)
|
||||
else
|
||||
startp = endp + 1;
|
||||
|
||||
endp = strchr(startp, PATHSEP);
|
||||
endp = first_path_separator(startp);
|
||||
if (!endp)
|
||||
endp = startp + strlen(startp); /* point to end */
|
||||
|
||||
@ -303,7 +296,7 @@ find_other_exec(const char *argv0, const char *target,
|
||||
return -1;
|
||||
|
||||
/* Trim off program name and keep just directory */
|
||||
*last_path_separator(retpath) = '\0';
|
||||
*last_dir_separator(retpath) = '\0';
|
||||
|
||||
snprintf(retpath + strlen(retpath), MAXPGPATH - strlen(retpath),
|
||||
"/%s%s", target, EXE);
|
||||
|
Reference in New Issue
Block a user