From 5a7e1a187ca878bdea5a31cc2805b32a9ae662c0 Mon Sep 17 00:00:00 2001 From: Bruce Momjian <bruce@momjian.us> Date: Wed, 19 May 2004 18:58:44 +0000 Subject: [PATCH] Move find_my_exec lower so elog() works, per Tom. --- src/backend/main/main.c | 12 +----------- src/backend/postmaster/postmaster.c | 7 ++++++- src/backend/tcop/postgres.c | 9 ++++++++- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/backend/main/main.c b/src/backend/main/main.c index fd78576c1b8..535da36b919 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.79 2004/05/18 20:27:24 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.80 2004/05/19 18:58:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -241,16 +241,6 @@ main(int argc, char *argv[]) #endif /* !WIN32 */ } - if (find_my_exec(argv[0], my_exec_path) < 0) - { - fprintf(stderr, - gettext("%s: could not locate my own executable path"), - argv[0]); - exit(1); - } - - get_pkglib_path(my_exec_path, pkglib_path); - /* * Now dispatch to one of PostmasterMain, PostgresMain, GucInfoMain, * SubPostmasterMain, pgstat_main, pgstat_mainChild or BootstrapMain diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 5bed34094c3..645bccff48e 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -37,7 +37,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.390 2004/05/18 20:27:25 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.391 2004/05/19 18:58:44 momjian Exp $ * * NOTES * @@ -461,6 +461,11 @@ PostmasterMain(int argc, char *argv[]) IgnoreSystemIndexes(false); + if (find_my_exec(argv[0], my_exec_path) < 0) + elog(FATAL, + gettext("%s: could not locate my own executable path"), + argv[0]); + /* * Options setup */ diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index 658976f2385..3abbb46e0b7 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.409 2004/05/18 20:27:25 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.410 2004/05/19 18:58:44 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -2185,6 +2185,13 @@ PostgresMain(int argc, char *argv[], const char *username) /* Set up reference point for stack depth checking */ stack_base_ptr = &stack_base; + if (find_my_exec(argv[0], my_exec_path) < 0) + elog(FATAL, + gettext("%s: could not locate my own executable path"), + argv[0]); + + get_pkglib_path(my_exec_path, pkglib_path); + /* * Set default values for command-line options. */ -- GitLab