Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3912b75

Browse files
committed
Fixed exec path problem.
1 parent b206958 commit 3912b75

File tree

4 files changed

+27
-17
lines changed

4 files changed

+27
-17
lines changed

src/backend/postmaster/postmaster.c

+13-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.83 1998/06/08 19:36:40 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.84 1998/06/08 22:28:26 momjian Exp $
1414
*
1515
* NOTES
1616
*
@@ -315,9 +315,19 @@ PostmasterMain(int argc, char *argv[])
315315
for (; i < 4; i++)
316316
new_argv[i] = "";
317317
new_argv[4] = NULL;
318+
319+
if (!Execfile[0] && FindExec(Execfile, argv[0]) < 0)
320+
{
321+
fprintf(stderr, "%s: could not find postmaster to execute...\n",
322+
argv[0]);
323+
exit(1);
324+
}
325+
new_argv[0] = Execfile;
326+
318327
execv(new_argv[0], new_argv);
319-
perror(new_argv[0]);
328+
320329
/* How did we get here, error! */
330+
perror(new_argv[0]);
321331
fprintf(stderr, "PostmasterMain execv failed on %s\n", argv[0]);
322332
exit(1);
323333
}
@@ -461,7 +471,7 @@ PostmasterMain(int argc, char *argv[])
461471
exit(2);
462472
}
463473

464-
if (!Execfile[0] && FindBackend(Execfile, argv[0]) < 0)
474+
if (!Execfile[0] && FindExec(Execfile, argv[0]) < 0)
465475
{
466476
fprintf(stderr, "%s: could not find backend to execute...\n",
467477
argv[0]);

src/backend/tcop/postgres.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.73 1998/06/04 17:26:45 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.74 1998/06/08 22:28:27 momjian Exp $
1111
*
1212
* NOTES
1313
* 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[])
11671167
SetCharSet();
11681168
#endif
11691169

1170-
if (FindBackend(pg_pathname, argv[0]) < 0)
1170+
if (FindExec(pg_pathname, argv[0]) < 0)
11711171
elog(FATAL, "%s: could not locate executable, bailing out...",
11721172
argv[0]);
11731173

@@ -1314,7 +1314,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
13141314
if (!IsUnderPostmaster)
13151315
{
13161316
puts("\nPOSTGRES backend interactive interface");
1317-
puts("$Revision: 1.73 $ $Date: 1998/06/04 17:26:45 $");
1317+
puts("$Revision: 1.74 $ $Date: 1998/06/08 22:28:27 $");
13181318
}
13191319

13201320
/* ----------------

src/backend/utils/init/findbe.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.7 1997/09/08 02:31:53 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.8 1998/06/08 22:28:28 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -144,14 +144,14 @@ ValidateBackend(char *path)
144144
}
145145

146146
/*
147-
* FindBackend -- find an absolute path to a valid backend executable
147+
* FindExec -- find an absolute path to a valid backend executable
148148
*
149149
* The reason we have to work so hard to find an absolute path is that
150150
* we need to feed the backend server the location of its actual
151151
* executable file -- otherwise, we can't do dynamic loading.
152152
*/
153153
int
154-
FindBackend(char *backend, char *argv0)
154+
FindExec(char *backend, char *argv0)
155155
{
156156
char buf[MAXPGPATH + 2];
157157
char *p;
@@ -188,11 +188,11 @@ FindBackend(char *backend, char *argv0)
188188
{
189189
strncpy(backend, buf, MAXPGPATH);
190190
if (DebugLvl)
191-
fprintf(stderr, "FindBackend: found \"%s\" using argv[0]\n",
191+
fprintf(stderr, "FindExec: found \"%s\" using argv[0]\n",
192192
backend);
193193
return (0);
194194
}
195-
fprintf(stderr, "FindBackend: invalid backend \"%s\"\n",
195+
fprintf(stderr, "FindExec: invalid backend \"%s\"\n",
196196
buf);
197197
return (-1);
198198
}
@@ -204,7 +204,7 @@ FindBackend(char *backend, char *argv0)
204204
if ((p = getenv("PATH")) && *p)
205205
{
206206
if (DebugLvl)
207-
fprintf(stderr, "FindBackend: searching PATH ...\n");
207+
fprintf(stderr, "FindExec: searching PATH ...\n");
208208
pathlen = strlen(p);
209209
path = malloc(pathlen + 1);
210210
strcpy(path, p);
@@ -225,14 +225,14 @@ FindBackend(char *backend, char *argv0)
225225
case 0: /* found ok */
226226
strncpy(backend, buf, MAXPGPATH);
227227
if (DebugLvl)
228-
fprintf(stderr, "FindBackend: found \"%s\" using PATH\n",
228+
fprintf(stderr, "FindExec: found \"%s\" using PATH\n",
229229
backend);
230230
free(path);
231231
return (0);
232232
case -1: /* wasn't even a candidate, keep looking */
233233
break;
234234
case -2: /* found but disqualified */
235-
fprintf(stderr, "FindBackend: could not read backend \"%s\"\n",
235+
fprintf(stderr, "FindExec: could not read backend \"%s\"\n",
236236
buf);
237237
free(path);
238238
return (-1);
@@ -243,6 +243,6 @@ FindBackend(char *backend, char *argv0)
243243
free(path);
244244
}
245245

246-
fprintf(stderr, "FindBackend: could not find a backend to execute...\n");
246+
fprintf(stderr, "FindExec: could not find a backend to execute...\n");
247247
return (-1);
248248
}

src/include/miscadmin.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $Id: miscadmin.h,v 1.24 1998/05/29 17:00:22 momjian Exp $
14+
* $Id: miscadmin.h,v 1.25 1998/06/08 22:28:30 momjian Exp $
1515
*
1616
* NOTES
1717
* some of the information in this file will be moved to
@@ -126,7 +126,7 @@ extern void SetPgUserName(void);
126126
extern Oid GetUserId(void);
127127
extern void SetUserId(void);
128128
extern int ValidateBackend(char *path);
129-
extern int FindBackend(char *backend, char *argv0);
129+
extern int FindExec(char *backend, char *argv0);
130130
extern int CheckPathAccess(char *path, char *name, int open_mode);
131131

132132
/* lower case version for case-insensitive SQL referenced in pg_proc.h */

0 commit comments

Comments
 (0)