Commit 3912b757 authored by Bruce Momjian's avatar Bruce Momjian

Fixed exec path problem.

parent b206958d
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.83 1998/06/08 19:36:40 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.84 1998/06/08 22:28:26 momjian Exp $
* *
* NOTES * NOTES
* *
...@@ -315,9 +315,19 @@ PostmasterMain(int argc, char *argv[]) ...@@ -315,9 +315,19 @@ PostmasterMain(int argc, char *argv[])
for (; i < 4; i++) for (; i < 4; i++)
new_argv[i] = ""; new_argv[i] = "";
new_argv[4] = NULL; new_argv[4] = NULL;
if (!Execfile[0] && FindExec(Execfile, argv[0]) < 0)
{
fprintf(stderr, "%s: could not find postmaster to execute...\n",
argv[0]);
exit(1);
}
new_argv[0] = Execfile;
execv(new_argv[0], new_argv); execv(new_argv[0], new_argv);
perror(new_argv[0]);
/* How did we get here, error! */ /* How did we get here, error! */
perror(new_argv[0]);
fprintf(stderr, "PostmasterMain execv failed on %s\n", argv[0]); fprintf(stderr, "PostmasterMain execv failed on %s\n", argv[0]);
exit(1); exit(1);
} }
...@@ -461,7 +471,7 @@ PostmasterMain(int argc, char *argv[]) ...@@ -461,7 +471,7 @@ PostmasterMain(int argc, char *argv[])
exit(2); exit(2);
} }
if (!Execfile[0] && FindBackend(Execfile, argv[0]) < 0) if (!Execfile[0] && FindExec(Execfile, argv[0]) < 0)
{ {
fprintf(stderr, "%s: could not find backend to execute...\n", fprintf(stderr, "%s: could not find backend to execute...\n",
argv[0]); argv[0]);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.73 1998/06/04 17:26:45 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.74 1998/06/08 22:28:27 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1167,7 +1167,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1167,7 +1167,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
SetCharSet(); SetCharSet();
#endif #endif
if (FindBackend(pg_pathname, argv[0]) < 0) if (FindExec(pg_pathname, argv[0]) < 0)
elog(FATAL, "%s: could not locate executable, bailing out...", elog(FATAL, "%s: could not locate executable, bailing out...",
argv[0]); argv[0]);
...@@ -1314,7 +1314,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[]) ...@@ -1314,7 +1314,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if (!IsUnderPostmaster) if (!IsUnderPostmaster)
{ {
puts("\nPOSTGRES backend interactive interface"); puts("\nPOSTGRES backend interactive interface");
puts("$Revision: 1.73 $ $Date: 1998/06/04 17:26:45 $"); puts("$Revision: 1.74 $ $Date: 1998/06/08 22:28:27 $");
} }
/* ---------------- /* ----------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.7 1997/09/08 02:31:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.8 1998/06/08 22:28:28 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -144,14 +144,14 @@ ValidateBackend(char *path) ...@@ -144,14 +144,14 @@ ValidateBackend(char *path)
} }
/* /*
* FindBackend -- find an absolute path to a valid backend executable * FindExec -- find an absolute path to a valid backend executable
* *
* The reason we have to work so hard to find an absolute path is that * The reason we have to work so hard to find an absolute path is that
* we need to feed the backend server the location of its actual * we need to feed the backend server the location of its actual
* executable file -- otherwise, we can't do dynamic loading. * executable file -- otherwise, we can't do dynamic loading.
*/ */
int int
FindBackend(char *backend, char *argv0) FindExec(char *backend, char *argv0)
{ {
char buf[MAXPGPATH + 2]; char buf[MAXPGPATH + 2];
char *p; char *p;
...@@ -188,11 +188,11 @@ FindBackend(char *backend, char *argv0) ...@@ -188,11 +188,11 @@ FindBackend(char *backend, char *argv0)
{ {
strncpy(backend, buf, MAXPGPATH); strncpy(backend, buf, MAXPGPATH);
if (DebugLvl) if (DebugLvl)
fprintf(stderr, "FindBackend: found \"%s\" using argv[0]\n", fprintf(stderr, "FindExec: found \"%s\" using argv[0]\n",
backend); backend);
return (0); return (0);
} }
fprintf(stderr, "FindBackend: invalid backend \"%s\"\n", fprintf(stderr, "FindExec: invalid backend \"%s\"\n",
buf); buf);
return (-1); return (-1);
} }
...@@ -204,7 +204,7 @@ FindBackend(char *backend, char *argv0) ...@@ -204,7 +204,7 @@ FindBackend(char *backend, char *argv0)
if ((p = getenv("PATH")) && *p) if ((p = getenv("PATH")) && *p)
{ {
if (DebugLvl) if (DebugLvl)
fprintf(stderr, "FindBackend: searching PATH ...\n"); fprintf(stderr, "FindExec: searching PATH ...\n");
pathlen = strlen(p); pathlen = strlen(p);
path = malloc(pathlen + 1); path = malloc(pathlen + 1);
strcpy(path, p); strcpy(path, p);
...@@ -225,14 +225,14 @@ FindBackend(char *backend, char *argv0) ...@@ -225,14 +225,14 @@ FindBackend(char *backend, char *argv0)
case 0: /* found ok */ case 0: /* found ok */
strncpy(backend, buf, MAXPGPATH); strncpy(backend, buf, MAXPGPATH);
if (DebugLvl) if (DebugLvl)
fprintf(stderr, "FindBackend: found \"%s\" using PATH\n", fprintf(stderr, "FindExec: found \"%s\" using PATH\n",
backend); backend);
free(path); free(path);
return (0); return (0);
case -1: /* wasn't even a candidate, keep looking */ case -1: /* wasn't even a candidate, keep looking */
break; break;
case -2: /* found but disqualified */ case -2: /* found but disqualified */
fprintf(stderr, "FindBackend: could not read backend \"%s\"\n", fprintf(stderr, "FindExec: could not read backend \"%s\"\n",
buf); buf);
free(path); free(path);
return (-1); return (-1);
...@@ -243,6 +243,6 @@ FindBackend(char *backend, char *argv0) ...@@ -243,6 +243,6 @@ FindBackend(char *backend, char *argv0)
free(path); free(path);
} }
fprintf(stderr, "FindBackend: could not find a backend to execute...\n"); fprintf(stderr, "FindExec: could not find a backend to execute...\n");
return (-1); return (-1);
} }
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: miscadmin.h,v 1.24 1998/05/29 17:00:22 momjian Exp $ * $Id: miscadmin.h,v 1.25 1998/06/08 22:28:30 momjian Exp $
* *
* NOTES * NOTES
* some of the information in this file will be moved to * some of the information in this file will be moved to
...@@ -126,7 +126,7 @@ extern void SetPgUserName(void); ...@@ -126,7 +126,7 @@ extern void SetPgUserName(void);
extern Oid GetUserId(void); extern Oid GetUserId(void);
extern void SetUserId(void); extern void SetUserId(void);
extern int ValidateBackend(char *path); extern int ValidateBackend(char *path);
extern int FindBackend(char *backend, char *argv0); extern int FindExec(char *backend, char *argv0);
extern int CheckPathAccess(char *path, char *name, int open_mode); extern int CheckPathAccess(char *path, char *name, int open_mode);
/* lower case version for case-insensitive SQL referenced in pg_proc.h */ /* lower case version for case-insensitive SQL referenced in pg_proc.h */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment