* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/port.h,v 1.34 2004/05/20 01:47:01 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.35 2004/05/20 15:38:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Portable way to find binaries */
-extern int find_my_exec(const char *argv0, char *full_path);
+extern int find_my_exec(const char *argv0, char *retpath);
extern int find_other_exec(const char *argv0, char const *target,
const char *versionstr, char *retpath);
#if defined(__CYGWIN__) || defined(WIN32)
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.11 2004/05/20 15:35:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.12 2004/05/20 15:38:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* non-threaded binaries, not in library routines.
*/
int
-find_my_exec(const char *argv0, char *full_path)
+find_my_exec(const char *argv0, char *retpath)
{
char cwd[MAXPGPATH];
char *p;
}
if (is_absolute_path(argv0))
- StrNCpy(full_path, argv0, MAXPGPATH);
+ StrNCpy(retpath, argv0, MAXPGPATH);
else
- snprintf(full_path, MAXPGPATH, "%s/%s", cwd, argv0);
+ snprintf(retpath, MAXPGPATH, "%s/%s", cwd, argv0);
- canonicalize_path(full_path);
- if (validate_exec(full_path) == 0)
+ canonicalize_path(retpath);
+ if (validate_exec(retpath) == 0)
{
- win32_make_absolute(full_path);
+ win32_make_absolute(retpath);
return 0;
}
else
{
- log_error("invalid binary \"%s\"", full_path);
+ log_error("invalid binary \"%s\"", retpath);
return -1;
}
}
/* Win32 checks the current directory first for names without slashes */
if (validate_exec(argv0) == 0)
{
- snprintf(full_path, MAXPGPATH, "%s/%s", cwd, argv0);
- win32_make_absolute(full_path);
+ snprintf(retpath, MAXPGPATH, "%s/%s", cwd, argv0);
+ win32_make_absolute(retpath);
return 0;
}
#endif
*endp = '\0';
if (is_absolute_path(startp))
- snprintf(full_path, MAXPGPATH, "%s/%s", startp, argv0);
+ snprintf(retpath, MAXPGPATH, "%s/%s", startp, argv0);
else
- snprintf(full_path, MAXPGPATH, "%s/%s/%s", cwd, startp, argv0);
+ snprintf(retpath, MAXPGPATH, "%s/%s/%s", cwd, startp, argv0);
- canonicalize_path(full_path);
- switch (validate_exec(full_path))
+ canonicalize_path(retpath);
+ switch (validate_exec(retpath))
{
case 0: /* found ok */
- win32_make_absolute(full_path);
+ win32_make_absolute(retpath);
free(path);
return 0;
case -1: /* wasn't even a candidate, keep looking */
break;
case -2: /* found but disqualified */
- log_error("could not read binary \"%s\"", full_path);
+ log_error("could not read binary \"%s\"", retpath);
free(path);
return -1;
}
* Win32 has a native way to find the executable name, but the above
* method works too.
*/
- if (GetModuleFileName(NULL,full_path,MAXPGPATH) == 0)
+ if (GetModuleFileName(NULL, retpath, MAXPGPATH) == 0)
log_error("GetModuleFileName failed (%i)",(int)GetLastError());
#endif
}